Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Is it possible to create a shortcut from a .exe using batch scripting?

share|improve this question

4 Answers 4

up vote 1 down vote accepted

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:

Set oWS = WScript.CreateObject("WScript.Shell")
sLinkFile = "C:\MyShortcut.LNK"
Set oLink = oWS.CreateShortcut(sLinkFile)

oLink.TargetPath = "C:\Program Files\MyApp\MyProgram.EXE"
' optional shortcut properties
' oLink.Arguments = ""
' oLink.Description = "MyProgram"
' oLink.HotKey = "ALT+CTRL+F"
' oLink.IconLocation = "C:\Program Files\MyApp\MyProgram.EXE, 2"
' oLink.WindowStyle = "1"
' oLink.WorkingDirectory = "C:\Program Files\MyApp"


share|improve this answer

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:

@echo off
echo [InternetShortcut] >> Explorer.url
echo URL=C:\WINDOWS\EXPLORER.EXE >> Explorer.url
echo IconFile=C:\WINDOWS\EXPLORER.EXE >> Explorer.url
echo IconIndex=0 >> Explorer.url

Which results in a file named Explorer.url to be created with this content inside of it:


Double clicking on it will work just as a shortcut and run the program.

share|improve this answer
That will only work reliably as you describe if IE is set as the default application to open a URL, which should never be assumed. –  John Gardeniers Oct 28 '10 at 2:14
Works regardless of whether or not IE is set as the default application to open a URL. I have used this form of shortcut since Windows 98 and have never had IE set as the default application to open a URL. –  Garrett R. Hylltun Oct 28 '10 at 2:34
If you notice, the association for .url in the registry points to rundll with and IE component as a parameter to the rundll. So, it's independent of whether IE is set to use .url files, but does require IE to be part of the system, which pretty much covers over 99%(uneducated estimate) of all Windows based PCs. Point is, likely only very deep computer users might be running without IE installed as part of their system and possibly some people in Europe who do not select IE as their browser when installing Windows since the mandatory selection screen. –  Garrett R. Hylltun Oct 28 '10 at 2:46

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 ( and call it in a bat. shortcut.exe /f:"%AllUsersProfile%\desktop\ShortcutName.pif" /a:c /t:folder:\MyApp ... i/image.icon.....

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.