Yes it is possible to create a shortcut, sort of... you can create a .url file which works just like a shortcut (.lnk) file from at least windows 98 on up to currently Windows 7. The .url file which is actually used for the Windows Favorites bookmarks is a simple text file which references a url and some additional information. Here is a simple example of making one from a batch file:
Using batch alone? Probably not, unless you're just copying a shortcut from the Start Menu to somewhere else. We had this issue when building/refining our latest deployment process and certain groups wanted shortcuts to everything on their desktop.
The Windows NT Resource Kit has a utility named shortcut.exe that could do this. I have never tested it on XP/2003/2008.
I think there's no way to create a batch file direct from a batch file, maybe you could write in the windows registry from bat or if you dont bother in using a third party app in this job, you can download shortcut.exe (www.optimumx.com) and call it in a bat.
shortcut.exe /f:"%AllUsersProfile%\desktop\ShortcutName.pif" /a:c /t:folder:\MyApp ... i/image.icon.....
Have you considered using Symbolic links? This maybe the closest alternative you can get.
1. Only Administrators can create symbolic links.
2. Requires VISTA or Higher OS with NTFS.
The utilities used to create them are built-in: MKLINK.exe and/or LINKD.exe
and can be easily scripted in a batch file.
Yes it is possible to create a shortcut, sort of... you can create a .url file which works just like a shortcut (.lnk) file from at least windows 98 on up to currently Windows 7. The .url file which is actually used for the Windows Favorites bookmarks is a simple text file which references a url and some additional information. Here is a simple example of making one from a batch file:
Which results in a file named Explorer.url to be created with this content inside of it:
[InternetShortcut]
URL=C:\WINDOWS\EXPLORER.EXE
IconFile=C:\WINDOWS\EXPLORER.EXE
IconIndex=0
Double clicking on it will work just as a shortcut and run the program.
Using batch alone? Probably not, unless you're just copying a shortcut from the Start Menu to somewhere else. We had this issue when building/refining our latest deployment process and certain groups wanted shortcuts to everything on their desktop.
The Windows NT Resource Kit has a utility named
shortcut.exe
that could do this. I have never tested it on XP/2003/2008.If you can get away with VBS, this would work:
Source
I think there's no way to create a batch file direct from a batch file, maybe you could write in the windows registry from bat or if you dont bother in using a third party app in this job, you can download shortcut.exe (www.optimumx.com) and call it in a bat. shortcut.exe /f:"%AllUsersProfile%\desktop\ShortcutName.pif" /a:c /t:folder:\MyApp ... i/image.icon.....
Have you considered using Symbolic links? This maybe the closest alternative you can get. 1. Only Administrators can create symbolic links. 2. Requires VISTA or Higher OS with NTFS.
The utilities used to create them are built-in: MKLINK.exe and/or LINKD.exe and can be easily scripted in a batch file.