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

10

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.

wojo

Posted 2009-10-08T15:45:42.950

Reputation: 385

Answers

15

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.

wojo

Posted 2009-10-08T15:45:42.950

Reputation: 385

5

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.

BJordan

Posted 2009-10-08T15:45:42.950

Reputation: 51

2

You can try the free tool, Junction by SysInternals

To search all the symlinks on a drive, go to the root and type:

C:\> junction -s -q

-s goes through all the subdirectories

-q ignores errors such as "Access is denied."

That will give you all the reparse points that Windows is currently using.

If you want to determine if a specific file or folder is a reparse point, just type the utility name and file/folder name after. Be careful with folder names since adding a backslash may change results.

C:\> junction c:\apps

Junction v1.06 - Windows junction creator and reparse point viewer
Copyright (C) 2000-2010 Mark Russinovich
Sysinternals - www.sysinternals.com

c:\apps: JUNCTION
   Substitute Name: e:\dropbox\apps

C:\>

Sun

Posted 2009-10-08T15:45:42.950

Reputation: 5 198

2

Try SageLinks - a small freeware open-source utility for Windows, it can find and re-check all symlinks as well as junctions and shortcuts:

SageLinks Screenshot

Nikolay Raspopov

Posted 2009-10-08T15:45:42.950

Reputation: 41

Can you add some information about the link, as opposed to just a picture? Cost, how did you find it, are you affiliated with it, etc? – Canadian Luke – 2015-10-03T23:37:40.943

This is a link to GitHub page with freeware open-source utility which finds (and checks for validity) all symlinks in Windows XP or later as asked in this question. – Nikolay Raspopov – 2015-10-05T03:42:18.750

Awesome, can you [edit] to add that to your answer? It helps future visitors know if it's a good answer quicker – Canadian Luke – 2015-10-05T03:56:21.863

Nice and fast. But NTFS hard links like c:/a//b work fine in win7; while sagelink flags them as invalid. Win7 allows both slashes, backslashes, extra-slashes. – mosh – 2018-03-14T11:23:34.330

Not allowed. Describe please how you created such links? – Nikolay Raspopov – 2018-03-28T19:09:37.590

0

Cygwin/bash script for win7

c:\> cat find-dead-links.sh
#!/usr/bin/bash
find . -maxdepth 3 -type l -print0 |
while IFS=   read -r -d $'\0' file ;do
  [[ -e "$file" ]] && continue
  echo "Bad link $file"
done 

mosh

Posted 2009-10-08T15:45:42.950

Reputation: 227

0

For all file searches on Windows systems i suggest using Everything. It's ultra fast and very lightweight.

Mihkel

Posted 2009-10-08T15:45:42.950

Reputation:

Everything is neat, but doesn't seem to be able to filter by Windows junction points, symlinks, etc. – wojo – 2009-10-08T19:00:18.097

0

I too was looking for this capability and haven't seen it elsewhere. I've added it to my Windows libraries for Python. Unfortunately, if you aren't already an avid Python programmer, you have a few steps to get everything installed.

  1. Download Python 2.6.4 and install it.
  2. Download distribute-setup (part of distribute) or ez_setup (part of setuptools) and run the script. This installs one of the two package managers for Python that my package requires to run.
  3. Use easy_install to install the jaraco.windows package and its dependencies. From the command-prompt:

x

\Python26\scripts\easy_install jaraco.windows

After following these steps, you should have a script called \python26\scripts\find-symlinks.exe or \python26\scripts\find-symlinks-script.py which you can execute with an optional pathname to search out symlinks. It will search out the symlinks and report the results, one line each. I tested this procedure on a clean install of Windows 7.

> cmd /c mklink /d mylink \windows 
symbolic link created for mylink <<===>> \windows
> cmd /c mklink myfilelink \windows\notepad.exe
symbolic link created for myfilelink <<===>> \windows\notepad.exe

> \python26\scripts\find-symlinks
D .\mylink --> \windows
  .\myfilelink --> \windows\notepad.exe

Jason R. Coombs

Posted 2009-10-08T15:45:42.950

Reputation: 1 952