Discussion Locked

desktop shortcuts via command line/batch

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

All -- is there a way, just like using the mouse and right-clicking, to create a functional desktop shortcut to launch an application?

I've tried: copy c:\application.exe "c:\documents and settings\%username%\desktop\shortcut to application.lnk" and it doesn't work.
It does create an icon on the desktop, but clicking it does nothing and right-clicking it says its an invalid shortcut.
I've tried copy/xcopy w/ various switches.

Any 411/help would be great...thanks...

5 replies

by haileyan

All you are doing in your example is renaming an executable. You are on the right track. Create a shortcut to the application copy the shortcut somewhere that it is accessible on the network.

So it will be:
copy \\server\share\application.lnk "c:\documents and settings\%username%\desktop\*.*"

If this is an appliction that everyone on the computer will use:

copy \\server\share\application.lnk "c:\documents and settings\All Users\desktop\*.*"

by ewgny

Try using a simple vbscript
change the special folders entry to
where you want the shortcut
http://tinyurl.com/6odth

set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\shortcut name.lnk")
oShellLink.TargetPath = "c:\application folder\application.exe"
oShellLink.WindowStyle = 1
oShellLink.IconLocation = "c:\application folder\application.ico"
oShellLink.Description = "Shortcut Script"
oShellLink.WorkingDirectory = "c:\application folder"
oShellLink.Save

by Member 32019386

I used the Wscript.exe syntax:
Shell.SpecialFolders("AllUsersDesktop")
and it worked great by putting the needed shortcut on the All Users Desktop.
Thanks for the tip!

This discussion is closed to new replies.