How to Create All Users Desktop Shortcut from Command Line - Windows 7, 8 and 10

Printer-friendly versionPDF version
How to Create All Users Desktop Shortcut from Command Line - Windows 7, 8 and 10

There isn't an easy way to create a shortcut from the command line on Windows. The easiest way we've found is to use a bat script to create vbs code, and then execute the code with cscript. It's actually really simple. Just paste the code below into a bat script and execute it to create a shortcut on the All Users desktop folder:

echo Set oWS = WScript.CreateObject("WScript.Shell") > CreateShortcut.vbs
echo sLinkFile = "C:\Users\Public\Desktop\ShortcutToSource.lnk" >> CreateShortcut.vbs
echo Set oLink = oWS.CreateShortcut(sLinkFile) >> CreateShortcut.vbs
echo oLink.TargetPath = "C:\sourceFolder" >> CreateShortcut.vbs
echo oLink.Save >> CreateShortcut.vbs
cscript CreateShortcut.vbs
del CreateShortcut.vbs
 
If this helps you out, please leave a comment below letting us know!

Which value(s) would you change to alter the title of the shortcut on the desktop?

You would change the 2nd line. Change "ShortcutToSource.lnk" to "CustomName.lnk"

Post new comment