How can I find all symlinks in Windows Vista or 7?

I'm looking for a way to search for all the symbolic links on a NTFS filesystem on Windows Vista or 7.

It would be even better if I could specify a specific target to see if it has any symlinks pointing to it, but a way to search for them all would be great, too.


Solution 1:

Here's the best way I've found thus far:

dir /a:l /s

But it's ugly. I'd prefer a listing that showed one file per line in the format of target => source or something similar. Grepping for SYMLINK doesn't do well because of the multi-line format. The /B bare switch doesn't give anything but the target filename, too.

Note that grep is a multiline tool. You can use -an to grab both the preceding and next n lines, and -An to just grab the next n lines. For example, grep -A10 configure would grab the next ten lines after finding the word "configure". If you had 2 instances of the word configure 3 lines apart, then you'd end up grabbing 14 lines total.

Solution 2:

Since Everything search has been re-written (January 2013), you can now search for attributes. A query of "attrib:L" will reveal all Symbolic Links of various types on your computer. Show Attributes column (Ctrl+Shift+8) to sort by attribute.

You can also create a Filter for that particular attribute search (Search, Add to Filters) if you do that type of search often or want to assign a keyboard shortcut.

I did notice the initial attrib: search appeared to lock-up Everything temporarily, but finished after a few seconds... worth the small wait for such a powerful tool.