Create Desktop Shortcuts Via Batch Script In Windows

Some application installers in Windows do not create a desktop icon.  I used this script to create one for all users.  Just modify the highlighted lines per your environment.

@echo off

set SCRIPT="%TEMP%\%RANDOM%-%RANDOM%-%RANDOM%-%RANDOM%.vbs"

echo Set oWS = WScript.CreateObject("WScript.Shell") >> %SCRIPT%
echo sLinkFile = "%PUBLIC%\Desktop\ShortcutName.lnk" >> %SCRIPT%
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> %SCRIPT%
echo oLink.TargetPath = "%SYSTEMDRIVE%\Program Files\MyApp.exe" >> %SCRIPT%
echo oLink.WorkingDirectory ="%SYSTEMDRIVE%\Program Files" >> %SCRIPT%
echo oLink.Save >> %SCRIPT%

cscript /nologo %SCRIPT%

del %SCRIPT%

 

2 Replies to “Create Desktop Shortcuts Via Batch Script In Windows”

Leave a Reply