General Find All Symbolic Links and Junction Points in Windows


  • Staff
Shortcut_banner.png

There are three types of file links supported in the NTFS file system: hard links, junctions, and symbolic links. Otherwise known as Reparse Points.

Hard Links can only be created for files. Any changes to that file are instantly visible to applications that access it through the hard links that reference it. Hard links do not support UNC paths (network paths that begin with \\). Hard links to a file will not have a shortcut arrow icon on them.

Symbolic Links are soft links that are basically advanced shortcuts. You can create a symbolic link to a local or remote file, folder, or shares path, and that link will appear to be the same as the target source. Symbolic links do support UNC paths (network paths that begin with \\). When you open a symbolic link, you will be redirected to the target source. Symbolic links will have a shortcut arrow icon on them.

Junctions (Directory Junction) are soft links that can only be created to a local folder (directory) path. Junction points make it appear as though folder (directory) actually exists at the location of the junction point, and your app won’t know any better. Junction points do not support UNC paths (network paths that begin with \\). Junction points will have a shortcut arrow icon on them.

Deleting anything in the link/junction or target (source) folder will delete it in both folders.

Deleting the hard link, symbolic link, or junction point itself will not delete anything in the target (source) folder.

This tutorial will show you how to find and list all hard links, symbolic links, and junction points and their target source in Windows 10 and Windows 11.


Contents





Option One

Find All Symbolic Links and Junction Points


1 Open a command prompt or elevated command prompt (recommended).

2 Type the command below you want to use into the command prompt, and press Enter. (see screenshot below)

(Output in command prompt)
DIR /AL /S "Directory Path"

OR​

(Output to "Links.txt" file on desktop)
DIR /AL /S "Directory Path" > "%UserProfile%\Desktop\Links.txt"

Substitute Directory Path in the command above with the actual full path of the drive or folder you want to search in to find and list all symbolic links and junction points.

Folder example: DIR /AL /S "C:\Users\Brink\Downloads" or DIR /AL /S "C:\Users\Brink\Downloads" > "%UserProfile%\Desktop\Links.txt"

Drive example: DIR /AL /S "C:\" or DIR /AL /S "C:\" > "%UserProfile%\Desktop\Links.txt"



3 You will now see a Directory of <path> listed for each folder symbolic links and/or junction points were found in. Under this path you will see the link file/folder name and its target source path.

Types of links:
  • <JUNCTION> = Junction point to folder (directory)
  • <SYMLINK> = Symbolic link to file
  • <SYMLINKD> = Symbolic link to folder (directory)

List_of_symbolic_links.jpg





Option Two

Find All Hard Links


1 Open a command prompt or elevated command prompt (recommended).

2 Type the command below into the command prompt, and press Enter. (see screenshot below)

CD "Directory Path"

Substitute Directory Path in the command above with the actual full path of the drive or folder you want to search in to find and list all hard links.

Folder example: CD "C:\Users\Brink\Downloads"


3 Copy and paste the command below into the command prompt, and press Enter. (see screenshot below)

(Output in command prompt)
echo off & for /F "delims=" %A in ('dir /s /b') do echo. & fsutil hardlink list "%A"

OR​

(Output to "HardLinks.txt" file on desktop)
echo off & for /F "delims=" %A in ('dir /s /b') do echo. & fsutil hardlink list "%A" > "%UserProfile%\Desktop\HardLinks.txt"


4 You will now see a list of full paths for all files found in the directory from step 2.
  • A single isolated line means the it's a normal file. You can ignore this.
  • Two lines together means it's a hard link. The top path will be for the hard link, and the bottom path will be for it's target source.

Find_hard_links_command.png



That's it,
Shawn Brink


 

Attachments

  • Shortcut.png
    Shortcut.png
    3.4 KB · Views: 28
Last edited:

Ghot

Well-known member
Pro User
VIP
Local time
11:39 PM
Posts
3,118
Location
PA, USA
OS
Win 11 Home ♦♦♦22000.778
I SO want to post that Schoolhouse Rock video... Conjunction Junction. :D
 

My Computers

System One System Two

  • OS
    Win 11 Home ♦♦♦22000.778
    Computer type
    PC/Desktop
    Manufacturer/Model
    Built by Ghot® [May 2020]
    CPU
    AMD Ryzen 7 3700X
    Motherboard
    Asus Pro WS X570-ACE
    Memory
    G.Skill (F4-3200C14D-16GTZKW)
    Graphics Card(s)
    EVGA RTX 2070 (08G-P4-2171-KR)
    Sound Card
    (onboard) Realtek ALC1220P / ALC S1220A
    Monitor(s) Displays
    Dell U3011 30"
    Screen Resolution
    2560 x 1600
    Hard Drives
    2x Samsung 860 EVO 500GB,
    WD 4TB Black FZBX - SATA III,
    WD 8TB Black FZBX - SATA III,
    LG GH22LS30 CD/DVD Burner
    PSU
    PC Power & Cooling 750W Quad EPS12V
    Case
    COOLER MASTER ATCS 840 Full Tower
    Cooling
    CM Hyper 212 EVO (push/pull)
    Keyboard
    Ducky DK9008 Shine II Blue LED
    Mouse
    Logitech Optical M-100
    Internet Speed
    100/100
    Browser
    Firefox (latest)
    Antivirus
    Bitdefender Internet Security (latest)
    Other Info
    Speakers: Klipsch Pro Media 2.1
  • Operating System
    Windows XP Pro 32bit w/SP3
    Computer type
    PC/Desktop
    Manufacturer/Model
    Built by Ghot®
    CPU
    AMD Athlon 64 X2 5000+ (OC'd @ 3.2Ghz)
    Motherboard
    ASUS M2N32-SLI Deluxe Wireless Edition
    Memory
    TWIN2X2048-6400C4DHX (2 x 1GB, DDR2 800)
    Graphics card(s)
    EVGA 256-P2-N758-TR GeForce 8600GT SSC
    Sound Card
    Onboard
    Monitor(s) Displays
    ViewSonic G90FB Black 19" Professional (CRT)
    Screen Resolution
    up to 2048 x 1536
    Hard Drives
    WD 36GB 10,000rpm Raptor SATA
    Seagate 80GB 7200rpm SATA
    Lite-On LTR-52246S CD/RW
    Lite-On LH-18A1P CD/DVD Burner
    PSU
    PC Power & Cooling Silencer 750 Quad EPS12V
    Case
    Generic Beige case, 80mm fans
    Cooling
    ZALMAN 9500A 92mm CPU Cooler
    Mouse
    Logitech Optical M-BT96a
    Keyboard
    Logitech Classic Keybooard 200
    Internet Speed
    100/100
    Browser
    Firefox 3.x ??
    Antivirus
    Symantec (Norton)
    Other Info
    Still assembled, still runs. Haven't turned it on for 13 years?

    http://www.xtremesystems.org/forums/showthread.php?183088-5000-B-E-on-M2N32-SLI-Dlx-Overclocked&p=2891724#post2891724

hdmi

Well-known member
Power User
VIP
Local time
5:39 AM
Posts
530
Location
Belgium
OS
11 Home
It doesn't work if the folder tree contains one or more files/folders that have special characters in their name. I wrote a fix, but only did some quick preliminary testing, so please let me know if it works or doesn't work.
Code:
echo off & chcp 65001>nul & cmd /q /c "for /F "delims= usebackq" %A in (`dir /s /b`) do (for /F "delims= usebackq" %B in (`fsutil hardlink list "\\?\%A"`) do (if not %A==%~dA%B (chcp 437>nul & echo %A& echo %~dA%B& echo.& chcp 65001>nul)))">"%UserProfile%\Desktop\HardLinks.txt" & chcp 437>nul & echo on
 

My Computer

System One

  • OS
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Medion S15450
    CPU
    i5 1135G7
    Memory
    16GB DDR4
    Graphics Card(s)
    Intel Iris Xe
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Medion Life X18102
    Screen Resolution
    3840×2160
    Hard Drives
    2TB SSD internal
    37TB external
    PSU
    Li-ion
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    20Mbit/s up, 200Mbit/s down
    Browser
    FF

geneo

Well-known member
Power User
VIP
Local time
11:39 PM
Posts
1,135
OS
Windows 11 Pro x64
Thanks, wasn't aware of these. I have always used Windows Sysinternals junction.exe:


Using Junction​

Syntax​

  • To obtain reparse point information: junction.exe [-s] [-q] <file or directory>
  • To create a junction point: junction.exe <junction directory> <junction target>
  • To delete a junction point: junction.exe -d <junction directory>
 

My Computers

System One System Two

  • OS
    Windows 11 Pro x64
    Computer type
    PC/Desktop
    Manufacturer/Model
    DIY
    CPU
    10900KF, 5.1 GHz all-core, delid
    Motherboard
    Asus Maximus Hero XIII Wifi
    Memory
    32GB G.skill TridentZ RGB 3200CL14 B-die @ 4100CL16
    Graphics Card(s)
    Asus ROG Strix 2070 Super A8G
    Sound Card
    Onboard Audio, Vanatoo Transparent One; Klipsch R-12SWi Sub
    Monitor(s) Displays
    Eizo CG2730, ViewSonic VP2768
    Screen Resolution
    2560 x 1440p x 2
    Hard Drives
    WDC SN850 1TB (OS+), Samsung 980 1TB (games), Raid 0: 1TB 850 EVO + 1TB 860 EVO. Sabrent USB-C DS-SC5B docking station: 6TB WDC Black, 6TB Ironwolf Pro; 2TB WDC Black
    PSU
    750W Seasonic Prime Ultra Titanium Plus
    Case
    Fractal Design Meshify 2 dark tint glass
    Cooling
    EK-AIO 360 D-RGB w/Phanteks T30-120 fans, Noctua NF-A14 Chromax case fan
    Keyboard
    Glorious GMMK TKL - Brown mechanical, lubed modded
    Mouse
    Logitech G305 wireless gaming
    Internet Speed
    238 Mb/s down, 12 Mb/s up
    Browser
    Firefox
    Antivirus
    Defender, Macrium Reflect 8 ;-)
    Other Info
    Logitech C920e Webcam (crap don't buy)
  • Operating System
    Mac OS Monterey
    Computer type
    Laptop
    Manufacturer/Model
    Apple 13" Macbook Pro 2020 (m1)
    CPU
    M1
    Monitor(s) Displays
    2560x1600
Top Bottom