In Windows 7, how can I check if a file is a symbolic link or not, if a folder is a junction or not, and how can I check where they are pointing at (in case they are symlink/junction). Both in Explorer and in Command line.

It's very important to have a way to do it from command line, in order to know how to duplicate symbolic links on another computer when you want to make an exact replica of a folder tree.

If I right click on a file and check "Properties", I can't find any indication that it's a symbolic link.

8 Answers 8


The dir command dir /a can do this:

2012-12-26  09:30 PM    <DIR>          .
2012-12-26  09:30 PM    <DIR>          ..
2012-12-26  09:30 PM                 0 a.txt
2012-12-26  09:30 PM    <SYMLINK>      link.txt [a.txt]

Alternatively, you can use Windows Explorer:

Right click column, More, Link Target
  • 1
    This doesn't work in windows 7 (Microsoft Windows [Version 6.1.7601])
    – gonzalezea
    Mar 24, 2016 at 14:00
  • 3
    @gonzalezea yeah, it does. It worked with Windows 7 back in 2012 when I posted this, and it works now too
    – Zombo
    Mar 24, 2016 at 15:22
  • 2
    Perhaps not so obvious to new users, this is a command line solution. The user must open a command prompt, then change directory (using the CD command) to a directory containing a symbolic link, then type the DIR command and press the 'enter' key. Running the DIR command in the wrong directory is a common mistake. But understandable, unless you are sure which directory a symlink is in (not always obvious, as the Windows GUI does not explicitly tell you whether a particular directory contains any symlinks or junctions). Look for a shortcut that has the type FILE FOLDER instead of SHORTCUT.
    – Ed999
    Jan 20, 2017 at 16:28
  • 6
    The link target field is empty on windows 7
    – ronenfe
    Jul 10, 2017 at 13:42
  • 1
    from the command line you should type in dir /a then press Enter. If you do not include the /a, windows does not list junction points. You can try the difference between dir and dir /a on directory \Users\YourUsername
    – Paulus
    Dec 21, 2017 at 8:50

Copied from StackOverFlow, I just used this line, and it works

fsutil reparsepoint query "folder name" | find "Symbolic Link" >nul && echo symbolic link found || echo No symbolic link


From MSDN about FSUtil : Performs tasks that are related to file allocation table (FAT) and NTFS file systems, such as managing reparse points, managing sparse files, or dismounting a volume. If it is used without parameters, fsutil displays a list of supported subcommands.

For our use, we just care that it outputs a line that has "Symbolic Link" in it, if it's symbolic, which we then find, and if find succeeds, we output one thing, if it doesn't, we output something else.


  • The quotes around the folder name are required if the path has spaces in it.
  • It gives the same output whether the folder doesn't exist, or isn't a symlink, use with caution.

Using PowerShell, on at least Windows OS, you can find symbolic-links in any given directory, such as the following:

Get-ChildItem 'C:\nodejs\bin\' | Where-Object {$_.LinkType -eq 'SymbolicLink'}

A more concise alternative would be to use Get-ChildItem's alias ls:

ls 'C:\nodejs' -Attributes ReparsePoint -Recurse

And you can get relevant information on a symbolic-link by doing any of the following:

Get the file item and output its Target property. Target being the "value" of the symbolic-link. In an addition, method or command signatures for creating symlinks when juxtaposing between operating systems, the arguments names of: 'target', 'path' and/or 'value' may hold different meanings than another method signature on a different OS.

E:\AIT> Get-Item -Path 'C:\nodejs\bin\ionic.cmd' | Select-Object -ExpandProperty Target

Get the file item and output its LinkType property. An item with a LinkType value of SymbolicLink means that its, well, symbolic.

E:\AIT> Get-Item -Path 'C:\nodejs\bin\ionic.cmd' | Select-Object -ExpandProperty LinkType

Get the file item and output its Mode property. An item with l in the Mode value indicates that it is a symbolic-link.

E:\AIT> Get-Item -Path 'C:\nodejs\bin\ionic.cmd' | Select-Object -ExpandProperty Mode

Get the file item and output its Attributes property. An item attributed with a ReparsePoint value maybe indicative to a symbolic-link.

E:\AIT> Get-Item -Path 'C:\nodejs\bin\ionic.cmd' | Select-Object -ExpandProperty Attributes
Archive, ReparsePoint

To check the location of Symlinks and Junction Points in Windows 7 or Windows 10...

Via Windows Explorer:

  1. Open the parent folder of the suspected symlink or junction point. (Note that symlinks and junction points get a shortcut icon applied in Windows 10 - not sure about Windows 7.)
  2. In the top of the Explorer window, in the row of column names, right-click and select "More...".

enter image description here

  1. Tick the box next to "Link Target" in the popup window that appears.

enter image description here

The path to the actual symlink location will be displayed in the Link target column that is added. Note that this only works for symlinks - not junction points:

enter image description here

Via Command Prompt:

  1. Navigate to the parent folder of the suspected symlink or junction point.
  2. Type dir /a.

A list of all files and folders will be displayed, including details of whether each is a symlink or junction point and where it points to:

enter image description here


Do not use fsutil to check if an item is a symbolic link or not. At first because errorlevel has errors, so sometimes, it stays to 0 and a real folder is viewed as a symbolic link. Errorlevel can not be trusted.

A problem with find is because find "Symbolic Link" is possible in English, but not in other languages.

The good way is to search from the attributes :

for %%i in ("%file_to_test%") do set attribute=%%~ai
set attribute=%attribute:~8,1%
if "%attribute%" == "l" (
    echo It's a symlink!
) else (
    echo Damned! It's real!

Attributes got with %a are "drahscotlep" and "l" is for symbolic link.


Here is a cygwin bash script to save symlinks, add your favourite folders to first line

find c:/ C:/Users/$USERNAME/SendTo C:/Users/$USERNAME/Desktop \
      -maxdepth 2 -type l \
      -printf 'mklink\t/D\t"%p"\t"%l"\n' | \
  perl -pne '\
      1;' | \
  sort -f | uniq  > restore-links.cmd

all credits to @SecurityAndPrivacyGuru , [cmd]

complete batch script/function that reads symlink{|s in folder} and outputs list with them and their target paths

@echo off
setlocal enableExtensions enableDelayedExpansion
cd /D "%~dp0"
set br=^

rem br;

set "pafIf=<<pafToSymlink|pafToFolder>>"
set "gIfZsymLink="
for /f "tokens=*" %%q in ('dir "!pafIf!" /al /b') do (
    for /f "tokens=2 delims=[]" %%r in ('dir /al ^| findstr /i /c:"%%q"') do (
        set "gIfZsymLink=!gIfZsymLink!%%~fq>%%r!br!"
set "gIfZsymLink=!gIfZsymLink:~0,-1!"
rem echo "!gIfZsymLink!"

for /f "tokens=1,2 delims=>" %%q in ("!gIfZsymLink!") do (
    echo symlink: %%q , filepath: %%r

rem endlocal
rem exit /b

If you really want to use fsutil, you can use both technics to prevent failure from errolevel. (I use ver >nul to reset errorlevel)

:function_is_symlink_file_folder item_to_test result
rem 0 = Error
rem 1 = Symlink
rem 2 = File
rem 3 = Folder

    setlocal enabledelayedexpansion
    set item_to_test=!%~1!
    set /a result=0
    for %%i in ("%item_to_test%") do set attributes=%%~ai
    set attribute_1=%attributes:~0,1%
    set attribute_9=%attributes:~8,1%
    ver >nul
    fsutil reparsepoint query "%item_to_test%" >nul
    if %errorlevel% == 1 (
        if "%attribute_1%" == "d" (
            set /a result=3
        ) else (
            set /a result=2
    ) else (
        if "%attribute_9%" == "l" (
            set /a result=1
        ) else (
            if "%attribute_1%" == "d" (
                set /a result=3
            ) else (
                set /a result=2
    endlocal & set /a %~2=%result%
goto :eof

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .