Creating shortcuts requires the use of the File Shell object. The following scripts demonstrate the use of the File Shell object to create shortcuts.

Example

 CopyCode imageCopy Code
// JScript.
Shell = new ActiveXObject("WScript.Shell");
DesktopPath = Shell.SpecialFolders("Desktop");
link = Shell.CreateShortcut(DesktopPath + "\\test.lnk");
link.Arguments = "1 2 3";
link.Description = "test shortcut";
link.HotKey = "CTRL+ALT+SHIFT+X";
link.IconLocation = "app.exe,1";
link.TargetPath = "c:\\blah\\app.exe";
link.WindowStyle = 3;
link.WorkingDirectory = "c:\\blah";
link.Save();

' VBScript.
Set Shell = CreateObject("WScript.Shell")
DesktopPath = Shell.SpecialFolders("Desktop")
Set link = Shell.CreateShortcut(DesktopPath & "\test.lnk")
link.Arguments = "1 2 3"
link.Description = "test shortcut"
link.HotKey = "CTRL+ALT+SHIFT+X"
link.IconLocation = "app.exe,1"
link.TargetPath = "c:\blah\app.exe"
link.WindowStyle = 3
link.WorkingDirectory = "c:\blah"
link.Save

See Also

Other Resources

Managing Shortcuts

In Vbsedit, you only need to press F1 to get Help for the keyword under the cursor!


Download Now!



Download   Home  

Copyright © 2001-2024 adersοft