Sets the arguments for a shortcut, or identifies a shortcut's arguments.
object.Arguments |
Arguments
- object
-
WshShortcut object.
Remarks
The Arguments property returns a string.
Example
The following code sets the Arguments property.
Visual Basic Script | Copy Code |
---|---|
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 |
JScript | Copy Code |
---|---|
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(); |