Create shortcut (VBScript)
This code can be found in
Chapter 4 of Windows Server Cookbook
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the VBScript code from this site.
' This code creates a shortcut.
set objWSHShell = CreateObject("WScript.Shell")
' Pass the path to the shortcut
set objSC = objWSHShell.CreateShortcut("d:\mylog.lnk")
' Description - Description of the shortcut
objSC.Description = "Shortcut to MyLog file"
' HotKey – hot key sequence to launch the shortcut
objSC.HotKey = "CTRL+ALT+SHIFT+X"
' IconLocation – Path of icon to use for the shortcut file
objSC.IconLocation = "notepad.exe, 0" ' 0 is the index
' TargetPath = Path to source file or folder
objSC.TargetPath = "c:\windows\notepad.exe"
' Arguments – Any additional parameters to pass to TargetPath
objSC.Arguments = "c:\mylog.txt"
' WindowStyle – Type of window to create
objSC.WindowStyle = 1 ' 1 = normal; 3 = maximize window; 7 = minimize
' WorkingDirectory – Location of the working directory for the source app
objSC.WorkingDirectory = "c:\"
objSC.Save
WScript.Echo "Shortcut to mylog created"
|
This code has been viewed 11107 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|