This subroutine creates a desktop shortcut. It could be modified to create shortcuts in any other location:
VBSTART
Sub NewDesktopShortcut(linkfile,targetpath,windowstyle,hotkey,descr)
Set WshShell = CreateObject("Wscript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\" & linkfile)
oShellLink.TargetPath = targetpath
oShellLink.WindowStyle = windowstyle
oShellLink.Hotkey = hotkey
'oShellLink.IconLocation = "notepad.exe, 0"
oShellLink.Description = descr
oShellLink.WorkingDirectory = strDesktop
oShellLink.Save
End Sub
VBEND
VBRun>NewDesktopShortcut,My App.lnk,d:\my documents\someapp.exe,1,CTRL+SHIFT+C,My Shortcut
Creating shortcuts
Moderators: Dorian (MJT support), JRL, Phil Pendlebury
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact: