Arguments Property (Shortcut Object)
Sets the arguments for a shortcut, or identifies a shortcut's arguments.
object.Arguments
The following code sets the Arguments property.
set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\Shortcut Script.lnk")
oShellLink.TargetPath = WScript.ScriptFullName
oShellLink.WindowStyle = 1
oShellLink.Hotkey = "Ctrl+Alt+f"
oShellLink.IconLocation = "notepad.exe, 0"
oShellLink.Description = "Shortcut Script"
oShellLink.WorkingDirectory = strDesktop
oShellLink.Arguments = "C:\myFile.txt"
oShellLink.Save
var WshShell = WScript.CreateObject("WScript.Shell"); var strDesktop = WshShell.SpecialFolders("Desktop"); var oShellLink = WshShell.CreateShortcut(strDesktop + "\\Shortcut Script.lnk"); oShellLink.TargetPath = WScript.ScriptFullName; oShellLink.WindowStyle= 1; oShellLink.Hotkey= "Ctrl+Alt+f"; oShellLink.IconLocation= "notepad.exe, 0"; oShellLink.Description= "Shortcut Script"; oShellLink.WorkingDirectory= strDesktop; oShellLink.Arguments = "C:\\myFile.txt"; oShellLink.Save();
Applies To:
Community Additions
Show: