Jump to content

Command to Pin or Unpin Program from Taskbar


piglovesrat15

Recommended Posts

Hello. Just want to ask anyone out there if they know a command to pin or unpin a program from taskbar. I know how to pin or unpin manually using the mouse and the shortcuts are in "%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\Taskbar".

What I try to do is run command if a specific shortcut in there, then delete it. I use the DEL command, it only deletes the shortcut in "%appdata%\Microsoft\Internet Explorer\Quick Launch\User Pinned\Taskbar" folder but the icon (even though it's now blank) still pins from the taskbar.

Thanks.

Link to comment
Share on other sites


I use two commands to do this. I got them from somewhere, can't remember where right now. First is a VBscript that preforms the operation you can shange the "Pin to Start Menu" to "Pin to Taskbar" (same for "Unpin...":

Set objShell = CreateObject("Shell.Application")

set filesystem = CreateObject("scripting.Filesystemobject")

Set objFolder = objShell.Namespace(filesystem.GetParentFolderName(Wscript.Arguments(0)))

Set objFolderItem = objFolder.ParseName(filesystem.GetFileName(WScript.Arguments(0)))

Set colVerbs = objFolderItem.Verbs

For Each objVerb in colVerbs

If Replace(objVerb.name, "&", "") = "Pin to Start Menu" Then objVerb.DoIt

If Replace(objVerb.name, "&", "") = "Unpin from Start Menu" Then objVerb.DoIt

Next

Then I make a cmd file with the items I want to Pin and point them to the VBScript:

cd /d %~dp0

WScript.exe %~dp0PinToStartMenu.vbs "path to app you want to Pin"

You can add multiple Items in the cmd file to Pin/Unpin all the items you want.

Link to comment
Share on other sites

  • 11 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...