Friday, December 1, 2017

windows - What different types of shortcut are there?



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:\Users\bshacklett\AppData\Roaming\microsoft\windows\Network
Shortcuts\BShacklett



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

PS C:\Users\bshacklett\AppData\Roaming\microsoft\windows\Network Shortcuts> cat .\BShacklett\desktop.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:



HKCR\CLSID\{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.


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...