How to Create a Shortcut (.lnk) to a Non-Existent Target

There are situations where you need to create a shortcut (.lnk) to a target that doesn’t exist on the computer. For instance, you want to create a set of shortcuts for using them on another computer.

However, the Create Shortcut wizard in Windows will not allow you to create a shortcut to a path that does not exist.

create shortcut to a file that does not exist

You’ll see the “The file <filename> cannot be found” error when doing so.

Workarounds

1: Use a VBScript

You can use a VBScript to create a shortcut (i.e., .lnk files, which are also known as Windows shell links) to a non-existent target. Here’s a sample script that creates a shortcut to Winword.exe.

Set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
Set oShellLink = WshShell.CreateShortcut(strDesktop & "\Word.lnk")
oShellLink.TargetPath = "C:\Program Files\Microsoft Office\Office16\Winword.exe"
oShellLink.IconLocation = "C:\Program Files\Microsoft Office\Office16\Winword.exe, 0"
oShellLink.Description = "Microsoft Word"
oShellLink.Save

Copy the above code to Notepad, save the file as “winword.vbs” and double-click to run it.

It creates a Word shortcut on the desktop, whether the target executable exists or not.


2: Use Shortcut.exe from OptimumX

Shortcut.exe is an old program from OptimumX.com that creates shortcuts using a command line. The program hasn’t been updated for over a decade, but it works on Windows 10 as well.

You can download it from https://www.optimumx.com/downloads.html#Shortcut

This utility allows you to create, modify or query Windows shell links (shortcuts) from the command-line. You can export the properties of an existing shortcut to a text file in .INI format. Use ‘Shortcut.exe /?‘ to view the syntax.



Requirements: Windows XP 64-bit or later. Windows 95 or later for Shortcut32.exe.

Example:

Shortcut.exe /F:winword.lnk /A:C /T:"C:\Program Files\Microsoft Office\Office16\Winword.exe" /d:"Microsoft Word"

The above command creates a shortcut to Winword.exe.

Command-line arguments

Shortcut [Version 1.20]

Creates, modifies or queries Windows shell links (shortcuts)


The syntax of this command is:

Shortcut.exe /F:filename /A:C|E|Q [/T:target] [/P:parameters] [/W:workingdir]
	 [/R:runstyle] [/I:icon,index] [/H:hotkey] [/D:description]

 /F:filename	: Specifies the .LNK shortcut file.
 /A:action	: Defines the action to take (C=Create, E=Edit or Q=Query).
 /T:target	: Defines the target path and file name the shortcut points to.
 /P:parameters	: Defines the command-line parameters to pass to the target.
 /W:working dir	: Defines the working directory the target starts with.
 /R:run style	: Defines the window state (1=Normal, 3=Max, 7=Min).
 /I:icon,index	: Defines the icon and optional index (file.exe or file.exe,0).
 /H:hotkey	: Defines the hotkey, a numeric value of the keyboard shortcut.
 /D:description	: Defines the description (or comment) for the shortcut.

 Notes:
 - Any argument that contains spaces must be enclosed in "double quotes".
 - If Query is specified (/A:Q), all arguments except /F: are ignored.
 - To find the numeric hotkey value, use Explorer to set a hotkey and then /A:Q
 - To prevent an environment variable from being expanded until the shortcut 
   is launched, use the ^ carat escape character like this: ^%WINDIR^%

 Examples:
   /f:"%ALLUSERSPROFILE%\Start Menu\Programs\My App.lnk" /a:q
   /f:"%USERPROFILE%\Desktop\Notepad.lnk" /a:c /t:^%WINDIR^%\Notepad.exe /h:846
   /f:"%USERPROFILE%\Desktop\Notepad.lnk" /a:e /p:C:\Setup.log /r:3

 An argument of /? or -? displays this syntax and returns 1.
 A successful completion will return 0.


 Copyright 2000-2005 Marty List, www.OptimumX.com

3. Place a dummy file

Another option is to place a dummy file (e.g., winword.exe) in the target location. And then create a shortcut to the dummy target by using the Create Shortcut wizard. After creating the shortcut, the dummy file can be deleted.

I hope the above information helps.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time.

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a ten-time recipient of the Microsoft MVP award in Windows Desktop Experience (Windows Shell), from 2003 to 2012. Ramesh founded Winhelponline.com in 2005.

Leave a Comment