Code: Select all
Set Shell = CreateObject("WScript.Shell")
Set link = Shell.CreateShortcut("pathto\linktomodify.lnk")
link.IconLocation = "pathto\icons.dll,"& WScript.Arguments(1)
link.Arguments = WScript.Arguments(0)
link.Save
This will change the argument to the 2nd parameter and the icon to the 1st parameter
calli it like this in a batch file or via cmd:
Code: Select all
scriptname.vbs "1st parameter" "2nd parameter" "more parameters up to 9"
Code: Select all
Set link
Code: Select all
link.IconLocation
Code: Select all
link.Arguments
Automatic creation is possible but can't supply all the parameters
use
Code: Select all
Set Shell = CreateObject("WScript.Shell")
DesktopPath = Shell.SpecialFolders("Desktop")
Set link = Shell.CreateShortcut(DesktopPath & "\winipcfg.lnk")
link.Arguments = ""
link.Description = "winipcfg shortcut"
link.HotKey = "CTRL+ALT+SHIFT+X"
link.IconLocation = ",0"
link.TargetPath = "c:\windows\winipcfg.exe"
link.WindowStyle = 1
link.WorkingDirectory = "d:\test"
link.Save
You can use WScript.Arguments(0), WScript.Arguments(1), WScript.Arguments(2) to add more parameters for a faster call via another batch script
For automatic creation use: