Search This Blog

Monday, May 13, 2013

Pin to Taskbar script

This is a short vbscript to pin programs to the taskbar.

The script can for example be used in a login script.

Set objShell = CreateObject("Shell.Application")

Set oShell = CreateObject("WScript.Shell")

Set ofso = CreateObject("Scripting.FileSystemObject")

 

strFile = "C:\Program Files (x86)\Microsoft Office\Office12\OUTLOOK.EXE"

PinToTaskBar

 

strFile = "C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE"

PinToTaskBar

 

 

sub PinToTaskBar

 

if ofso.fileexists(strFile) then

   Set objFolder = objShell.Namespace(ofso.GetParentFolderName(strFile))

   Set objFolderItem = objFolder.ParseName(ofso.GetFileName(strFile))

   Set colVerbs = objFolderItem.Verbs

   For Each objVerb in colVerbs

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

   Next

End IF

 

End Sub

Programs pinned to taskbar:

image

No comments:

Post a Comment