Easily Create Windows Shortcuts

While you can right click on a file and choose “Create Shortcut” in Windows 7, I disliked the naming convention of “filename.ext – Shortcut.lnk”. I use FreeCommander for all my file management needs and it didn’t have a built-in way to create a shortcut either.

Here’s a short VBScript I wrote that takes two parameters, (1) the path to the original file and (2) the destination directory.

if WScript.Arguments.Count = 0 then
    WScript.Echo "Usage: <original_file> <destination_folder>"
    WScript.Quit
end if

set fso = createobject("scripting.filesystemobject")

origFile = fso.getFile(WScript.Arguments(0))
lnkPath = fso.buildpath(WScript.Arguments(1), fso.getbasename(origFile) & ".lnk")
lnkPath = fso.GetAbsolutePathName(lnkPath)

Set objShell = CreateObject("WScript.Shell")
Set lnk = objShell.CreateShortcut(lnkPath)
lnk.TargetPath = origFile
lnk.Save

Here’s how you can add it as a tool in FreeCommander:

Add tool to FreeCommander

1. Download this zip file and extract it.

2. In FreeCommander, go to Extras -> Favorite tools -> Edit and add the path to where you saved mklnk.vbs in the Program field.

3. Add this to the Parameter field: %ActivSel% “%InactivDir%”

4. (Optional) Enter the path to mklnk.ico in the Icon File field.

To use it, navigate to where you want the shortcut to end up in one pane, then in the other pane select the file you want to create a shortcut to, then click the toolbar icon.

Comments are closed