You don't necessarily need to download additional programs to list junctions, symlinks and hard links, but if you have specific output format requirements, they may help.
List all junctions, symlinks and symlink directories in the current directory and its subdirectories:
dir /al /s
Or if you want them listed separately...
List all junctions in the current directory and its subdirectories:
dir /al /s | findstr "<JUNCTION>"
List all symlinks in the current directory and its subdirectories:
dir /al /s | findstr "<SYMLINK>"
List all symlink directories in the current directory and its subdirectories:
dir /al /s | findstr "<SYMLINKD>"
l attribute flag is key here;
l is for
Reparse Points (junctions, symlinks and symlink directories)
dir lists hard links as normal files, so you cannot use it to identify hard links. You an use the inbuilt
fsutil instead. It needs to be run from an elevated command prompt.
fsutil, list all hard links in the current directory and its subdirectories:
for /F "usebackq tokens=2* delims=:" %G in (`forfiles /s /c "cmd /c fsutil hardlink list @path | findstr /n .* | findstr /b /v 1"`) do @fsutil hardlink list "%G" & echo.
This one-liner is not ideal, and I would welcome any improvements.
forfiles with the recurse subdirectories option (
hammered my CPU, and took a while to complete.
fsutil basically ends up running twice; the first time to
identify the hard links by counting the number of output lines returned by each call, and the second time on just-found hard links to get the output right.
- There will be duplicate lines. To eliminate them you'd want to redirect the output to a file and then run the file through a tool like
Here's a batch file that uses just
for to identify hard links. As
forfiles is not involved, it may be slightly faster, however it still suffers the remaining caveats of the above one-liner.
AT > NUL
if %ERRORLEVEL% NEQ 0 echo You need to run this script from an elevated command prompt. Exiting. && exit /B 1
for /R "%CD%" %%a IN (*.*) do (
for /F "usebackq tokens=2* delims=:" %%b in (`fsutil hardlink list "%%a" ^| findstr /n .* ^| findstr /b /v 1`) do (
fsutil hardlink list "%%b"
REM The following echo command breaks up each group of hard links with a blank line
There are a few other (untested) options:
Use the (old) Microsoft HL Scan utility
hlscan /dir %CD%
Use the alternative find command that comes with the Microsoft's SFUA utility toolkit:
find . -links +1
Use the Sysinternals' findlinks utility in a similar way to
fsutil mentioned above
Use Uwe Sieber's ListLinks program - see link for usage
Use Nirsoft's NTFSLinksView if you prefer a GUI application