Share this page 

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

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


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"

[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