sodcalculator

10 Tech How-To

Fix a Broken Symbolic Link in Windows

Guide 10-55943 · Updated · Step by step

Symbolic links (symlinks) are special files that point to another file or folder. When the target is moved, renamed, or deleted, the link becomes broken and Windows may show errors like “The file or directory is corrupted and unreadable” or “The system cannot find the file specified.” This guide shows you how to identify and fix broken symbolic links using built-in Windows tools, with no third-party software required.

What You’ll Need

  • Windows 10 or Windows 11 (the steps work on older versions too, but the command syntax may differ slightly)
  • Administrator account (some commands require elevated privileges)
  • Command Prompt or PowerShell opened as Administrator

Step-by-Step

  1. Open Command Prompt or PowerShell as Administrator. Press Windows + X and select “Terminal (Admin)” or “Command Prompt (Admin)”. If prompted by User Account Control, click “Yes”.
  2. Find the broken link. You can use File Explorer to navigate to the location where the link resides. Look for a file or folder icon with a small arrow overlay. If you don’t know where it is, use the dir command in the terminal to list files with their attributes. For example, type dir /AL to list all symbolic links in the current directory.
  3. Identify the target path. In the terminal, use the dir command with the link name to see what it points to. For example: dir "C:\path\to\link". The output shows the target path in the “” or “” line.
  4. Check if the target exists. Navigate to the target path in File Explorer or use dir on the target. If it doesn’t exist, you need to either recreate the target or point the link to a new location.
  5. Fix the link by recreating it. The simplest fix is to delete the broken link and create a new one. To delete a symbolic link (not the target), use: del "C:\path\to\link" for files, or rmdir "C:\path\to\link" for directories. Then create a new link with the correct target using mklink (for Command Prompt) or New-Item -ItemType SymbolicLink (for PowerShell).
  6. Use mklink to create a new symbolic link. In Command Prompt, the syntax is: mklink /D "C:\path\to\newlink" "C:\actual\target" for directories, or mklink "C:\path\to\newlink" "C:\actual\target" for files. The /D flag is required for directory links.
  7. If you prefer PowerShell, use New-Item. Example: New-Item -ItemType SymbolicLink -Path "C:\path\to\newlink" -Target "C:\actual\target". This works for both files and directories.
  8. Verify the fix. After recreating the link, test it by opening it in File Explorer or using dir to confirm it points to the correct target and no longer shows an error.

Common Mistakes

  • Deleting the target instead of the link. When you use del or rmdir on a symbolic link, it deletes the link itself, not the target. But if you use File Explorer and press Delete on a link, it may ask if you want to delete the target—always choose “Delete shortcut” or “Remove link” to avoid deleting the actual data.
  • Using the wrong command for directories. In mklink, you must add /D for directory links. Without it, you create a file link, which will not work for folders.
  • Forgetting to run as Administrator. Creating symbolic links requires administrator privileges. If you get “You do not have sufficient privilege” error, close and reopen the terminal as Admin.
  • Using relative vs absolute paths incorrectly. If you create a link with a relative target, it may break if the link is moved. Use absolute paths unless you have a specific reason.

Tips

  • Use dir /AL to list all symbolic links in a directory. This helps you spot broken ones quickly.
  • Check the target path for typos. A common cause of broken links is a misspelled or slightly different path. Copy-paste the target path from the original location to avoid errors.
  • Consider using junctions for directories. Junctions (created with mklink /J) work without administrator privileges and are less likely to break when the target is on the same volume. However, they only work for local paths, not network shares.
  • If you have many broken links, use a script. You can write a simple batch or PowerShell script to scan a directory and recreate links based on a list of targets.

Troubleshooting

If the fix doesn’t work, try these steps:

  • Check if the target path is accessible. Sometimes the target exists but is on a network drive that is not currently connected. Make sure the drive is mapped and accessible.
  • Look for permission issues. If you get “Access denied” when creating a link, ensure you have write permission to the folder where the link is placed, and that you are running as Administrator.
  • Use fsutil reparsepoint query to inspect the link. This command shows detailed information about the reparse point, including the target path. Run it on the link path to verify the target is correct.
  • If the link is in a system folder, you may need to take ownership. Right-click the folder, go to Properties > Security > Advanced, and change the owner to your account. Then try again.
  • Recreate the link in a different location. If the link still fails, create a new link in a different folder and test it. This helps isolate whether the problem is with the link or the target.

Frequently Asked Questions

What is a symbolic link?

A symbolic link is a file system object that points to another file or directory. It acts like a shortcut but is treated by the OS as the actual file or folder, so applications can access the target transparently.

How do I know if a link is broken?

In File Explorer, a broken link may show a warning icon or give an error when opened. In the command line, dir will show the link but the target may not exist. You can also use fsutil reparsepoint query to see the target path and verify it.

Can I fix a broken link without deleting it?

No, Windows does not provide a direct “repair” option. You must delete the broken link and recreate it with the correct target. This is a quick process and does not affect the target data.

Will recreating a link affect the target files?

No. Deleting a symbolic link only removes the link itself. The target file or folder remains untouched. Recreating the link simply points to the target again.

Why do I need administrator privileges to create a symbolic link?

Symbolic links can be used to access resources outside the user’s normal permissions, so Windows requires elevated privileges to prevent unauthorized redirection. Junctions (mklink /J) do not require admin rights and are a good alternative for local directories.

Can I use symbolic links to connect to network drives?

Yes, but the link will only work if the network drive is available. If the drive is not connected, the link will appear broken. Consider using a mapped drive letter or a UNC path instead.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →