0

Since Windows 7(mayne Vista too) I have a problem with pinning an item to taskbar. The path to taskbar is %appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar, but adding either .bat, .exe, or even pasting a .lnk there manually doesn't show anything new on the taskbar even after reboot. Pasting to Default user's location solves nothing.

Why is it like that and what I have to do after I paste something to this location to make it work?

I'm not interested in drag&drop because I write a script and the script is a batch, so I really don't need non-batch solutions either(for example creating item on taskbar w/ vbs).

1 Answer 1

0

This is because the pinned items are also registered when something is pinned.

Unfortunately, because of this, a batch solution won't work. A vbscript however can make it work. Its a script too, and like .cmd or .bat will work on other computers and through the logon script. Alternatively (but ugly) you can use wscript or cscript to execute your script from the batch file.

To pin an item to the taskbar use the following script:

' print name of item

Const CSIDL_COMMON_PROGRAMS = &H17
Const CSIDL_PROGRAMS = &H2
Set objShell = CreateObject(“Shell.Application”)
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & “\Accessories”)
Set objFolderItem = objFolder.ParseName(“Calculator.lnk”)
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
    Wscript.Echo objVerb
Next

and to pin the actual item

Const CSIDL_COMMON_PROGRAMS = &H17
Const CSIDL_PROGRAMS = &H2
Set objShell = CreateObject(“Shell.Application”)
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & “\Accessories”)
Set objFolderItem = objFolder.ParseName(“Calculator.lnk”)
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
    If Replace(objVerb.name, “&”, “”) = “Pin to Start Menu” Then objVerb.DoIt
Next

Source: https://blogs.technet.microsoft.com/deploymentguys/2009/04/08/pin-items-to-the-start-menu-or-windows-7-taskbar-via-script/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .