Create a shortcut with VBScript or PowershellTag(s): WSH VBScript


A shortcut is special binary file with the .lnk extension.

[VBS]

Set WshShell = CreateObject("WScript.Shell")
strDesktopPath = WshShell.SpecialFolders("Desktop")
'
'   or  strDesktopPath = WshShell.SpecialFolders("AllUsersDesktop")
'
Set objShortcutUrl = WshShell.CreateShortcut(strDesktopPath & "\textpad.lnk")
objShortcutUrl.TargetPath = "C:\Program Files\TextPad 4\textpad.exe"
objShortcutUrl.Description = "Start Textpad"
objShortcutUrl.Save

[Powershell one-liner]

powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%userprofile%\Desktop\MediaMonkeyBackup.lnk');$s.TargetPath='D:\Things\Utils\X-update-mm-db.cmd';$s.Save()"

To create a shortcut from Powerbuilder, see this HowTo.

To create an Internet shortcut, see this HowTo


blog comments powered by Disqus