Creating Shorcut on Windows Desktop using VB Script


'------------------------------------------
' Create Lock Workstation shortcut in the All Users Desktop folder

Set oShell = CreateObject("WScript.Shell")
sAllUsersDesktopPath = oShell.SpecialFolders("AllUsersDesktop")
sWinSysDir = oShell.ExpandEnvironmentStrings("%SystemRoot%\System32")
Set oShortCut = oShell.CreateShortcut(sAllUsersDesktopPath & "\Lock Workstation.lnk")
oShortCut.TargetPath = sWinSysDir & "\Rundll32.exe"
oShortCut.Arguments = "User32.dll,LockWorkStation"
oShortCut.IconLocation = sWinSysDir & "\Shell32.dll,47"
oShortCut.Save
MsgBox "Lock Workstation shortcut is now created.", _
         vbInformation + vbSystemModal, "Create shortcut"
'------------------------------------------

1 comment:

  1. That is easy, but how to create shortcut in ALLUSERSPROFILE \Microsoft\Windows\Start Menu

    ReplyDelete