Hello
Is it still possible to use the VB script in Windows 8 that many of us used to pin programs and shortcuts in Windows 7. I just have a couple items I would like to have pinned on users desktop taskbars and the script below worked perfect in Windows 7. I tried it today and nothing gets pinned but it still deletes itself. Any ideas? I did verify I had the .lnk in the locations below.
Thank you!
Is it still possible to use the VB script in Windows 8 that many of us used to pin programs and shortcuts in Windows 7. I just have a couple items I would like to have pinned on users desktop taskbars and the script below worked perfect in Windows 7. I tried it today and nothing gets pinned but it still deletes itself. Any ideas? I did verify I had the .lnk in the locations below.
Thank you!
Code:
Option Explicit
Const CSIDL_COMMON_PROGRAMS = &H17
Const CSIDL_PROGRAMS = &H2
Const CSIDL_STARTMENU = &HB
Dim objShell, objFSO
Dim objCurrentUserStartFolder
Dim strCurrentUserStartFolderPath
Dim objAllUsersProgramsFolder
Dim strAllUsersProgramsPath
Dim objFolder
Dim objFolderItem
Dim colVerbs
Dim objVerb
Set objShell = CreateObject("Shell.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objCurrentUserStartFolder = objShell.NameSpace (CSIDL_STARTMENU)
strCurrentUserStartFolderPath = objCurrentUserStartFolder.Self.Path
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path
' - Pin to Taskbar -
'Microsoft Outlook 2013
If objFSO.FileExists(strAllUsersProgramsPath & "\Microsoft Office 2013\Outlook 2013.lnk") Then
Set objFolder = objShell.Namespace(strAllUsersProgramsPath & "\Microsoft Office 2013")
Set objFolderItem = objFolder.ParseName("Outlook 2013.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next
End If
'Snipping Tool
If objFSO.FileExists(strCurrentUserStartFolderPath & "\Programs\Accessories\Snipping Tool.lnk") Then
Set objFolder = objShell.Namespace(strCurrentUserStartFolderPath & "\Programs\Accessories")
Set objFolderItem = objFolder.ParseName("Snipping Tool.lnk")
Set colVerbs = objFolderItem.Verbs
For Each objVerb in colVerbs
If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next
End If
'Delete the script
DeleteSelf
Sub DeleteSelf()
Dim objFSO
'Create a File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Delete the currently executing script
objFSO.DeleteFile WScript.ScriptFullName
Set objFSO = Nothing
End Sub
Last edited by a moderator:
My Computer
System One
-
- OS
- Windows 8