Windows – quick way to create a Windows shortcut to a file without it validating the path

shortcutwindows

Trying to create a shortcut for someone else. It needs to point to files on one of their mapped drives. Instead of waiting for them to be available and create the shortcut on their PC, I was hoping to just create the shortcut on my PC and then transfer it over to their PC.

However Windows tries to validate the path as you create the shortcut and since I don't have access to the same files it is throwing up an error and won't create the shortcut.

Is there a way to create a shortcut without the path being validated?

Best Answer

You can use this VBScript to create a shortuct:

   Set oWS = WScript.CreateObject("WScript.Shell")
   sLinkFile = "C:\MyShortcut.LNK"
   Set oLink = oWS.CreateShortcut(sLinkFile)
   oLink.TargetPath = "C:\Program Files\MyApp\MyProgram.EXE"
   oLink.Save