System Administration Uncategorized

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


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%


4 replies on “Create Desktop Shortcuts Via Batch Script In Windows”

This works great. I tried running this bat file from network drive and it didn’t work. Can you please provide solution to this ?

That is a loaded question. How far did you get in the guide and what details can you provide?

Leave a Reply