Create or edit a Windows Shortcut

      ShortcutObject.property = "Your Value"

   objShell   A WScript.Shell object
   ShortcutObject  An existing shortcut object


   Set objShell = WScript.CreateObject("WScript.Shell")
   Set lnk = objShell.CreateShortcut("C:\MyShortcut.LNK")
   lnk.TargetPath = "C:\Program Files\MyApp\MyProgram.EXE"
   lnk.Arguments = ""
   lnk.Description = "MyProgram"
   lnk.HotKey = "ALT+CTRL+F"
   lnk.IconLocation = "C:\Program Files\MyApp\MyProgram.EXE, 2"
   lnk.WindowStyle = "1"
   lnk.WorkingDirectory = "C:\Program Files\MyApp"
   'Clean up 
Set lnk = Nothing Similarly in Powershell: $objShell = New-Object -ComObject WScript.Shell $lnk = $objShell.CreateShortcut("$home\Desktop\DemoShortcut.lnk") $lnk.TargetPath = "C:\demo.exe" $lnk.Save()

The 'Description' property corresponds to the shortcut "Comment" field, this will be displayed in a tool-tip.

HotKey mappings are only usable if the shortcut is on the Desktop or in the Start Menu.
Valid hot key-options:
"ALT+", "CTRL+", "SHIFT+", and "EXT+".
"A" .. "Z", "0" .. "9", "Back", "Tab", "Clear", "Return", "Escape", "Space", and "Prior".

Internet Shortcuts
Unlike file/folder shortcuts, Internet Explorer Favourite (.URL) files are simple text files which you can create with a couple of ECHO statements:

Echo [InternetShortcut] > demo.url
Echo URL=https://ss64.com/ >> demo.url

“Our life is frittered away by detail... simplify, simplify” - Henry David Thoreau


Arguments, display - WshArguments.Item
Q263324 - Shortcut command truncates path names if the target does not currently exist.
Equivalent Windows CMD command: SHORTCUT - Create a windows shortcut (.LNK file)

Copyright © 1999-2020 SS64.com
Some rights reserved