Is there a way to see a list of all the symbolic links that are active on a Windows machine?


In PowerShell

Get-ChildItem -Path C:\ -Force -Recurse -ErrorAction 'silentlycontinue' | 
  Where { $_.Attributes -match "ReparsePoint"}
  • -Force includes hidden and system files
  • -Recurse gets all child items
  • -ErrorAction 'silentlycontinue' suppresses Access to the path XYZ is denied errors
  • Where { $_.Attributes -match "ReparsePoint"} checks folders and files if it's a junction

Explanation of Mode and Attributes:

PS > GCI | SELECT Mode,Attribuets -Unique

Mode                    Attributes
----                    ----------
d----                    Directory
d---s            System, Directory
d---- Directory, NotContentIndexed
d----        Directory, Compressed
la---                      Archive
-a---                      Archive
lar--            ReadOnly, Archive
-a---          Archive, Compressed
| improve this answer | |
  • Thanks -- this could be really powerful for scripting -- is there a property that displays where the link goes to? -- it doesn't seem to be displayed by default, but if it's there we could script against it and that would be awesome. – BrainSlugs83 Oct 12 '14 at 1:11
  • 2
    @BrainSlugs83 To get the target of ReparsePoints programmatically , read this SO answer – nixda Dec 4 '14 at 23:38
  • How to just get the ones create by the current user and not the OS? – boardtc Jan 15 at 17:14
  • Thanks, I think your answer is more self-documenting now. If Dir = GCI please add it back. – Louis Waweru Sep 19 at 5:42

Try the following command:

dir /AL /S C:\
  • /A displays all files with a specific attribute, and L specifies reparse points (symlinks and directory junctions)
  • /S makes the command recursive
  • replace C:\ with the drive letter you want to scan, or with a path if you don't want to scan an entire drive
| improve this answer | |
  • 7
    Is there a way to make it not recurse into symlinks / junctions so that it doesn't get stuck in an infinite loop? – BrainSlugs83 Oct 12 '14 at 1:09

There's also a handy program for that called NTFSLinksView.

Edit: there's also SageLinks, this one checks the validity too.

| improve this answer | |

I know this answer is late, but here's perhaps something closer to what you were probably looking for:

dir /AL /S C:\ | find "SYMLINK"
| improve this answer | |
  • 1
    Of course this will also show files and directories that have SYMLINK in their name. – Scott Sep 25 '18 at 0:38
  • @Scott but if this is identical to the accepted answer, then all those folders regardless of their name will be symbolic links. – Mark C Apr 17 at 7:42
  • @MarkC: Ah, in my haste to comment (over 1½ years ago), I failed to notice that this was Indrek’s answer plus a garnish, and I failed to register the /AL.  Still, Indrek’s answer explains that /AL specifies listing reparse points (which include symlinks and directory junctions), and so it becomes a question of definitions.  If you (IMHO, incorrectly) consider directory junctions to be a type of symlink, then this answer is wrong because it filters out directory junctions like Local Settings, My Documents and My Pictures.  … (Cont’d) – Scott Apr 17 at 17:13
  • 1
    (Cont’d) …  If you consider directory junctions not to be a type of symlink, then this answer is wrong because it shows directory junctions that have SYMLINK in their name. (And it can be fixed just by changing it to find "<SYMLINK".) – Scott Apr 17 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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