sasdaniels
asked on
VBS Script to create shortcut to folder
Hi this is a script I used for an exe (someone helped me!), it creates a folder on desktop ok, but, I get the what program do you want to use prompt - funnily enough if I pick Internet Explorer it does open the folder. So maybe I need to associate the .lnk with explorer.exe in some way ? Possible in objShortCut.Arguments ? (thats leftover/unused script at moment . .)
Set objShell = WScript.CreateObject("WScr ipt.Shell" )
strDesktopFolder = objShell.SpecialFolders("A llUsersDes ktop")
Set objShortCut = objShell.CreateShortcut(st rDesktopFo lder & "\Manuals & Procedures.lnk")
objShortCut.TargetPath = """W:\Office Manual""" '<-- only the executable
'objShortCut.Arguments =" -pf s:\config\help.pf -basekey INI -ininame s:\config\help.ini -T ""%TEMP%""" '<-- argument stored in here
objShortCut.Description = "Manuals & Procedures"
objShortCut.IconLocation = "C:\WINDOWS\system32\SHELL 32.dll, 19"
objShortCut.Save
Set objShell = WScript.CreateObject("WScr
strDesktopFolder = objShell.SpecialFolders("A
Set objShortCut = objShell.CreateShortcut(st
objShortCut.TargetPath = """W:\Office Manual""" '<-- only the executable
'objShortCut.Arguments =" -pf s:\config\help.pf -basekey INI -ininame s:\config\help.ini -T ""%TEMP%""" '<-- argument stored in here
objShortCut.Description = "Manuals & Procedures"
objShortCut.IconLocation = "C:\WINDOWS\system32\SHELL
objShortCut.Save
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks EDDYKT
I put "c:\windows\explorer.exe" in objShortCut.TargetPath
and """W:\Office Manual""" in objShortCut.Arguments
Thus
Set objShell = WScript.CreateObject("WScr ipt.Shell" )
strDesktopFolder = objShell.SpecialFolders("A llUsersDes ktop")
Set objShortCut = objShell.CreateShortcut(st rDesktopFo lder & "\Manuals & Procedures.lnk")
objShortCut.TargetPath = "c:\windows\explorer.exe" '<-- only the executable
objShortCut.Arguments ="""W:\Office Manual""" '<-- argument stored in here
objShortCut.Description = "Manuals & Procedures"
objShortCut.IconLocation = "C:\WINDOWS\system32\SHELL 32.dll, 19"
objShortCut.Save
I put "c:\windows\explorer.exe" in objShortCut.TargetPath
and """W:\Office Manual""" in objShortCut.Arguments
Thus
Set objShell = WScript.CreateObject("WScr
strDesktopFolder = objShell.SpecialFolders("A
Set objShortCut = objShell.CreateShortcut(st
objShortCut.TargetPath = "c:\windows\explorer.exe" '<-- only the executable
objShortCut.Arguments ="""W:\Office Manual""" '<-- argument stored in here
objShortCut.Description = "Manuals & Procedures"
objShortCut.IconLocation = "C:\WINDOWS\system32\SHELL
objShortCut.Save
ASKER
Maybe I didn't explain clearly - there's no exe it's a short cut to a folder only, but, script doesn't associate the object with explorer . .