batch file - Generated script doesn't create shortcuts -
my windows 8 pc doesn't seem want create shortcuts using vbscript. problem is, somehow can't saved. seems problem pc has.
i trying create temporary vbscript using batch, output is:
c:\users\albert~1\appdata\local\temp\11338-3520-31784-27073.vbs(5, 1) wshshortcut.save: shortcut "c:\users\albertmøller\downloads\desktop\askontrolpanel.lnk" not saved.
this vbscript code:
set script="%temp%\%random%-%random%-%random%-%random%.vbs" echo set ows = wscript.createobject("wscript.shell") >> %script% echo slinkfile = "desktop\askontrolpanel.lnk" >> %script% echo set olink = ows.createshortcut(slinkfile) >> %script% echo olink.targetpath = "%programdata%\autoshutdown\automaticshutdown.bat" >> %script% echo olink.save >> %script% cscript /nologo %script% del %script%
it seems work on other computers have tested on, 3. try open administrator rights, still doesn't work.
try code , tell me if works or not ?
@echo off mode con cols=87 lines=5 & color 9b title generer le vbscript pour la creation du raccourci sur le bureau hackoo echo generer le vbscript pour la creation du raccourci timeout /t 2 > nul ( echo call shortcut("%windir%\system32\calc.exe","calculatrice"^) echo ^'**********************************************************************************************^) echo sub shortcut(cheminapplication,nom^) echo dim objshell,desktoppath,objshortcut,mytab echo set objshell = createobject("wscript.shell"^) echo mytab = split^(cheminapplication,"\"^) echo if nom = "" echo nom = mytab(ubound^(mytab^)^) echo end if echo desktoppath = objshell.specialfolders("desktop"^) echo set objshortcut = objshell.createshortcut(desktoppath ^& "\" ^& nom ^& ".lnk"^) echo objshortcut.targetpath = dblquote^(cheminapplication^) echo objshortcut.iconlocation = "winver.exe,0" echo objshortcut.save echo end sub echo ^'********************************************************************************************** echo ^'fonction pour ajouter les doubles quotes dans une variable echo function dblquote(str^) echo dblquote = chr(34^) ^& str ^& chr^(34^) echo end function echo ^'********************************************************************************************** ) > shortcutme.vbs echo execution du vbscript pour la creation du raccourci de la calculatrice sur le bureau start /wait shortcutme.vbs echo suppression du vbscript del shortcutme.vbs echo termine pause > nul
Comments
Post a Comment