Create a windows shortcut (.LNK file) Originally in the NT4 Server Resource Kit, this utility fails under Windows 10.
A good free alternative is shortcut.exe from [ mirror].

Shortcuts can also be created using VBScript or PowerShell see the examples below.

      SHORTCUT [options]

   -t target    : The path and file name of the application/document to open.
   -a arguments : The arguments passed when the shortcut is used.
   -d directory : The folder to start the application in.
   -i iconfile  : The file the icon is in.
   -x index     : The index into the icon file.
   -n name      : The path and file name (.LNK) of the shortcut file.
   -c           : Change existing shortcut.
   -r           : Resolve broken shortcut.
   -f           : Force overwrite of an existing short cut.
   -s           : Make shortcut simple (don’t use LinkResolve).
   -l logfile   : Save any error messages in the specified file.
   -u [spec]    : ECHO the contents of an existing shortcut. 
                  'all' is the same as 'natdix' but the letters 
                  of 'natdix' specify the options to be exported
                  The same option can be specified more than once e.g. -u natn

Shortcut Icons

Any DLL or other icon resource iconfile can be used as the source for a custom shortcut icon.
If you will be transferring the Shortcut file to another machine, the iconfile must be in a location that is available to that machine.
The index selects a specific icon within the file.

The following classic Icon Resource files are available on all Windows 10 and 11 machines:

Sample shell32.dll index numbers:
shell32.dll icon samples
Sample imageres.dll index numbers:
imageres.dll icon samples

In Desktop.ini files, a negative number for IconIndex indicates a resource ID (WinAPI) not a file reference.

Bonus: a small zip file with 19 simple color square Start-Menu .ico icons (Free/Public Domain).

Shortcut Auto LinkResolve

By default shortcuts will include the machine name of the destination, even for a local file like C:\MyFile.doc
This is not immediately visible until the shortcut file is copied to another machine, the shortcut target will then be automatically updated to point back to \\Machine1\c$\MyFile.doc
To turn this behaviour off add a DWORD value of 1 to the registry (before creating the shortcut):


Shortcut NTFS file system tracking

If a shortcut to a file breaks because the destination file has moved, then by default Windows will attempt to automatically locate the shortcut destination by performing a search or matching file properties. This is done by the background service "TrkWks".

This can be turned on or off via the Group Policy Do not use the tracking-based method when resolving shell shortcuts or directly in the registry:


0 = disabled, 1 = enabled (REG_DWORD)

Advertised Shortcuts

An application shortcut created by .Net setup may not have the 'target' property enabled/visible. These shortcuts are known as 'Advertised Shortcuts' will perform Install-On-Demand, they will trigger installation of the application if it is missing (e.g. if the user has roamed to a different machine). After installation, the shortcut target can be decoded.

To disable the creation of an advertised shortcut during an msi install, use:

Internet Shortcuts

Unlike file/folder shortcuts, Favourite (.URL) files are simple text files which you can create with a text editor or a couple of ECHO statements, they will open in the default browser:

Echo [InternetShortcut] > demo.url
Echo URL= >> demo.url

Internet Explorer Pinned .website links

A file saved with a .website extension is an IE Pinned link. These are deprecated and by default will no longer open in IE11 or Microsoft Edge. The internal format is vaguely similar to the older .url file format, so simply renaming the file from .website to .url may mean that it opens in Edge. This is very much a dirty hack, so don't bulk rename hundreds of .website files and expect them all to work.

Microsoft Edge Shortcuts

If MS Edge is not your default browser, but you want to open a web page using Edge, set an explorer Shortcut Target to a path like the following:

%windir%\explorer.exe microsoft-edge:

Or if Edge is installed on the C: drive, you can simply do:

"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"
Note that Edge installs itself in the x86 folder even though it is a 64 bit application.

Chrome Shortcuts

If Google Chrome is not your default browser, but you want to open a web page using Chrome, set the Shortcut Target to a path like the following, note that Chrome installs itself in the x86 folder even though it is a 64 bit application:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"


Create a shortcut to MyApp.exe

 SHORTCUT -f -t C:\demo\MyApp.exe -n %userprofile%"\start menu\programs\MY APP\MY APP"

An alternative is to use VBScript, call the VB script with cscript like so:
CSCRIPT C:\batch\makeshortcut.vbs

Optional sections in the VBscript below are commented out:

   strLinkFile = "$env:Public\Desktop\MyShortcut.lnk"
   strTargetPath = "C:\demo\MyApp.exe"
   Set objWS = WScript.CreateObject("WScript.Shell")
   Set objLink = objWS.CreateShortcut(strLinkFile)
   objLink.TargetPath = $strTargetPath
   '  objLink.Arguments = ""
   '  objLink.Description = "MyProgram"
   '  objLink.HotKey = "ALT+CTRL+F"
   '  objLink.IconLocation = "%SystemRoot%\SystemResources\shell32.dll.mun, 94"
   '  objLink.WindowStyle = "1"
   '  objLink.WorkingDirectory = "C:\Program Files\MyApp"

The same thing can be done to create a shortcut in PowerShell:

   $strTargetPath = "C:\demo\MyApp.exe"
   $strLinkFile = "$env:Public\Desktop\MyShortcut.lnk"
   $WScriptShell = New-Object -ComObject WScript.Shell
   $Shortcut = $WScriptShell.CreateShortcut($strLinkFile)
   $Shortcut.TargetPath = $strTargetPath
   $Shortcut.IconLocation = "%SystemRoot%\SystemResources\shell32.dll.mun, 94"

“The reasonable man adapts himself to the world: the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man” ~ George Bernard Shaw

Related commands

Explorer.exe - Open Windows Explorer to show a directory, also accepts variables.
MD - Create folder(s)
FSUTIL - Create a Hardlink.
PowerShell: New-Shortcut
RUN commands - Start ➞ Run commands.
Q158682 - Shortcuts resolve to a UNC Path (LinkResolveIgnoreLinkInfo)
Q150215 - Disable Automatic Shortcut Resolution.
Q254493 - Shortcut.exe fails with sub-folder names.
Q263324 - Shortcut.exe truncates long path names.
Q134552 - Shortcut key for shortcut only works when placed on Start Menu.
Equivalent bash command (Linux): symlink - Make a new name for a file, ln - Make links between files.

Copyright © 1999-2024
Some rights reserved