batch file - Modify "Start in" properties box of shortcut with VBS? -
i'm trying create basic installer , i'm having trouble shortcut. installer works fine, program refuses start shortcut gets created because missing "start in" box information, how go putting information in vbs?
here have far, shortcut gets created , else fine, code works fine other .exe's , launches them fine, not 1 program:
set mypath=%cd% set script="%temp%\%random%-%random%-%random%-%random%.vbs" echo set ows = wscript.createobject("wscript.shell") >> %script% echo slinkfile = "%userprofile%\desktop\shortcut.lnk" >> %script% echo set olink = ows.createshortcut(slinkfile) >> %script% echo olink.targetpath = "%mypath%/myexe.exe" >> %script% echo olink.save >> %script% cscript /nologo %script% del %script%
edit: here finished working script if needs 1 create shortcuts:
set mypath=%cd% set script="%temp%\%random%-%random%-%random%-%random%.vbs" echo set ows = wscript.createobject("wscript.shell") >> %script% echo slinkfile = "%userprofile%\desktop\my shortcut.lnk" >> %script% echo set olink = ows.createshortcut(slinkfile) >> %script% echo olink.targetpath = "%mypath%/myexe.exe" >> %script% echo olink.workingdirectory = "%mypath%" >> %script% echo olink.save >> %script% cscript /nologo %script% del %script%
according the docs, should set .workingdirectory
, maybe like
echo olink.workingdirectory = "c:\path\to\folder" >> %script%
to on save side, avoid backwards backslashes , variables need expanding - in
echo olink.targetpath = "%mypath%/myexe.exe" >> %script%
Comments
Post a Comment