What different types of shortcut are there?

Posted on

QUESTION :

I’ve noticed that Windows seems to be capable of creating multiple different types of shortcuts. At the moment, I’m trying to understand a Folder shortcut that exists in my profile’s Network Shortcuts folder. In Windows Explorer it shows up as a folder with the shortcut overlay, the Type listed is “File folder” and double-clicking it takes me to a network location. Viewing it in powershell shows that it’s a folder and inside of it is a “target.lnk” file.

Also, I often find that the Properties window of other shortcuts will be missing the “Target” field. I think these might be Windows Installer shortcuts. Excluding Junctions and Symbolic Links, are there any other types of shortcuts out there? Better yet, is there any documentation I can look at that lists them all?

*edit: more info below about the shortcut type that I’m primarily concerned with.

Explorer sees a folder (BShacklett) as a shortcut. Powershell sees the following:

Directory: C:UsersbshacklettAppDataRoamingmicrosoftwindowsNetwork
ShortcutsBShacklett


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
---hs        2012-06-11     10:50         75 desktop.ini
-a---        2012-06-11     10:50       1450 target.lnk

PS C:UsersbshacklettAppDataRoamingmicrosoftwindowsNetwork Shortcuts> cat .BShacklettdesktop.ini

[.ShellClassInfo]
CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}
Flags=2

ANSWER :

There’s no complete list, but what you are looking at is called a “folder-shortcut”, a folder that behaves like a shortcut to another object, and is undocumented (at least by Microsoft).

As you saw, it is a regular folder that contains the files desktop.ini and target.lnk. The .lnk file is a regular shortcut file that must be named target.lnk, and the desktop.ini contains the following:

[.ShellClassInfo]
CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}
Flags=2

You can see some information about how it is handled by Explorer in the following registry entry:

HKCRCLSID{0AFACED1-E828-11D1-9187-B532F1E9575D}

They essentially act like an alias for a folder, except that they do not automatically take on the layout of the real one. That is, if you activate and size the columns in a folder, then create a folder-shortcut to it, opening the folder via the folder-shortcut will let you see the actual contents of the original folder, but the columns configuration (and other attributes like window position, etc.) will be the defaults, not the customized ones—opening the original folder through regular means (directly, file-shortcut, etc.) will display it with the customizations.

As you might guess by the fact that the class-identifier used to create folder-shortcuts points to shell32.dll, they are only resolved by Explorer and are treated like ordinary directories by the command-interpreter (and PowerShell).

They are not frequently used in practice, but they can be somewhat useful and are almost like an alias which is nice because older versions of Windows (like ME, 2000, and XP) did not support some types of aliases well, if at all. One way that they are created automatically by Explorer is when you drag a folder to the Start Menu. When you drag a folder to another folder, the Quick Launch bar, etc., a regular file-shortcut to the folder is created, but when you drag it to the Start Menu, a folder-shortcut is created which allows it to be like a sub-menu (i.e., expandable).

One thing to note is that while you can use them to make expandable menus, they only behave like this one-level deep. Therefore, making a folder-shortcut to a folder, putting that in another folder, then making a folder-shortcut to that folder and putting it in a menu will not let you make a three-level expandable menu. Instead, what you’ll get is a menu that contains a folder which expands to show another folder that expands to show a shortcut named target.

There are Shortcuts wich are simply *.lnk files, and Junction/Hard link/Symbolic link wich are NTFS objects. Don’t mix them.

Shortcuts may be targeted to Paths (files and folders) and PIDL's (wich are not editable in the Explorer interface).

In addition to the 4 types that @Maximus has listed, there is a 5th type which are “special” system shortcuts defined in the registry.

Examples of these include things like the “libraries” in Windows 7, Fonts, Printers, etc.

.lnk and Junctions are Windows (NTFS partition) specific. Hard and Symbolic links are also found in many other filing systems including all of the UNIX like OS’s (Linux, BSD, Mac, etc.).

Hard and Symbolic links can only be set up from the command line with native Windows tools. But there is an excellent Windows Explorer add-in that allows the creation of them. Junctions can be created from the command line or from the Windows Control Panel disk utility. Lnk links are Windows Explorer specific.

I much prefer to use symbolic links for most purposes. They work well with mixed OS environments and work with most Windows software.

Leave a Reply

Your email address will not be published.