Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When attempting to create a shortcut to another shortcut, Windows XP assigns the target of the original shortcut to the new shortcut. This happens even when I enter the target path manually, and I am left with a copy of the original shortcut. This is not what I want.

How can make a .lnk file point to another .lnk file directly? This form of double indirection would be very useful for managing shortcuts to files that move frequently.

share|improve this question
    
In windows 7 it just works... It is not the same in XP? – soandos May 18 '12 at 2:35
    
@soandos: It creates a copy of the shortcut instead of creating a shortcut to a shortcut. – Mehrdad May 18 '12 at 2:42
    
@soandos If you make a shortcut to a shortcut, the new shortcut will reference the first shortcut's path, not the path of the shortcut file itself. This is the default behavior in Windows XP and 7. – iglvzx May 18 '12 at 2:42

The simplest workaround would be to use Batch files.

If Shortcut.lnk is located in C:\Files\, making a new .bat file with the following single line of code will launch the .lnk file:

"C:\Files\Shortcut.lnk"
share|improve this answer
    
Yeah I already knew about this (it's the 'answer' mentioned everywhere else on the internet when you search for this), but it doesn't really answer the question... – Mehrdad May 18 '12 at 3:09
    
Is there a reason why the "shortcut" to the .lnk file must also be a .lnk file? If this is important or if you have any other requirements, edit your question to include these details. You will get a better answer that way. :) – iglvzx May 18 '12 at 4:31
    
Uhm, yes, because that's what I asked in the question... if .bat files were enough then Microsoft wouldn't have made .lnk files... – Mehrdad May 18 '12 at 5:16
    
And FYI, batch files behave nothing like shortcuts the moment you right-click them (or heck, they don't even look like shortcuts even when you look at them). – Mehrdad May 18 '12 at 5:16
    
Ok. I went ahead and edited your question to make this requirement more clear. – iglvzx May 18 '12 at 5:53

I completely understand the utility of linking to links, and I have been searching for an easy solution as well. The best one I've come up with is to simply use Hardlinks, which point to the shortcut.lnk file. I've tested symbolic links (junctions are just for folders, not files, so they weren't tested) and these do NOT work (they are basically broken files when created, which fail to open).

Hardlinks have a number of advantages and disadvantages. The primary disadvantage is that they are almost impossible to backup easily (you need third party software or scripting to back them up to another dive or even to another location on the same drive). The primary advantage is that they automatically update when you modify the original file, so changing 1 shortcut file (new path/icon) changes all associated hardlinks as well [names for the hardlink, however, are unique, so changing a filename doesn't change the hardlink name and vice versa]. Another feature which is both an advantage and disadvantage of hardlinks is that changing icon/path for the hardlink (changing hardlink data) ALSO changes THE ORIGINAL. This does NOT include 'deleting the link itself' (the link can be deleted as any other file; without deleting the original file itself). This is advantageous because it keeps all the associated links synchronized, but it's disadvantageous in cases where the hardlink is stored in a vulnerable location, and it's data is maliciously modified, or a user error is made in modifying a single link's data. This change will be carried through to all hardlinked partners including the original. Frankly this behavior is generally useful, except in cases where you'd want a 'stable source reference' (1-way modification)

I've tested copying individual hardlinks and folders containing hardlinks, in windows explorer, and the result just creates dissociated shortcuts to the original data (no longer associated hardlinks, and therefore, don't change with modifications to the original link). I find this lack of simple copying extremely annoying, and the primary reason I'd be reluctant to use them extensively, but, if you only have a few for a specific purpose (like synchronizing links from a stable directory, to the desktop/taskbar/startmenu) they may still be a good solution (eventhough, they aren't really portable to other systems, without writing a script to automate their directory building). They DO, however, move around without breaking (you can move them anywhere in the file system, once they are created. You just can't 'copy' them). You can also make as many hardlinks to a single source as you want, but again, you can't easily 'copy-and-paste' you have to make a new hardlink from scratch for each 'copy' you want.

To make a hardlink, just open an elevated command prompt (.cmd opened to system32, or run .cmd as admin) and type:

mklink /H [path and name of Hardlink] [location of original file]

Example:

mklink /H C:\users\you\desktop\hardlink.lnk C:\users\you\location\shortcut.lnk

It's good to designate the hardlink with the filetype it links to (like, here, .lnk, but for notepad documents hardlink.txt, or similar), because it's basically a mirroring of the original file, and windows explorer treats it as if it were the original (again, a useful behavior). I should also directly state that they are ONLY created through command prompt (or 3rd party software which gives a shellExtension or gui for the command). Also, they aren't a 'mirrored copy' of the original, they may show the original object's file sizes, but they intrinsically take up 0bytes of space on the drive; they are actually references stored to the MFT of the drive (which is also the reason they can't be made between 2 different partitions [which is another feature of them worth mentioning; but which is easily overcome with a clever combo of shortcuts, junctions, symlinks, and hardlinks used together in unison])

Frankly, I believe this is exactly what you are looking for, and it is a very useful feature. If you can script well, I'm sure it's not difficult to write a program which simply builds a hardlink directory as you desire (and treat that as a 'backup' or 'portability solution' for other systems). You might also be able to find 3rd party software to make all of these tasks easier, and overcome the intrinsic unwieldiness of working with hardlinks.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.