mklink command builder

Build mklink commands for junctions, symbolic links and hard links, with the PowerShell New-Item equivalent and common mistakes flagged.

Build a correct mklink command for a directory junction, a symbolic link or a hard link, with the PowerShell New-Item equivalent next to it. The builder puts the link and the target in the right order, quotes paths that need it, and flags the mistakes that make mklink fail or create the wrong thing: a hard link across drives, a junction to a network share, a link that points to itself. Nothing is executed and nothing leaves your browser.

Build mklink and New-Item commands for symlinks, junctions and hard links, with common mistakes flagged.

Runs in your browser

How to use

  1. Pick a preset that matches your task, or choose the link type yourself. The line under the type selector says what that type is for.
  2. Link is the new name you are creating. It must not exist yet.
  3. Target is the file or folder that already exists and holds the real data.
  4. Read the confirmation line under the output: “Creates a junction at … that points to …”. If it reads backwards, swap the two fields.
  5. Fix anything flagged in red or amber. Where the fix is a different link type, one click switches it.
  6. Copy the Command Prompt line, or the PowerShell line if you work in PowerShell, and run it. Check the elevation note under each block first.
  7. Use Share link to send the exact command to a colleague or save it in a ticket.

All four types live on NTFS. The difference is what they can point to and who can create them.

TypeFlagForTarget can beNeeds adminNetwork target
Directory junction/JFoldersAny local driveNoNo
Directory symbolic link/DFoldersAnywhere, including UNCYes*Yes
File symbolic linknoneFilesAnywhere, including UNCYes*Yes
Hard link/HFilesSame volume onlyNoNo
* Not needed when Developer Mode is enabled in Windows Settings.

For a folder on the same machine, a junction is usually the right answer: no elevation, and it works across drives, so C: to D: is fine. Use a directory symbolic link when the target is a network share or when you need a relative target. Use a hard link only for a second name of a file on the same volume.

FAQ

Frequently asked questions

The link comes first, the target second: mklink /J <new link> <existing folder>. This is the opposite of copy and robocopy, which is why it gets reversed so often. Reversed, it usually fails with “Cannot create a file when that file already exists”, because the existing folder ends up in the link position. mklink does not check that the target exists, so a typo in the target still succeeds and gives you a link to nowhere. The confirmation line under the builder output shows both paths in plain words.

Practical examples

Example 1: move an application folder to another drive. C: is full and C:\ProgramData\BigApp holds 40 GB. From an elevated prompt, stop the application, copy the folder with its permissions, rename the original, then leave a junction behind so the application still finds its data at the old path. Open in the builder.

robocopy "C:\ProgramData\BigApp" "D:\BigApp" /E /COPYALL /DCOPY:T /R:1 /W:1
ren "C:\ProgramData\BigApp" BigApp.old
mklink /J "C:\ProgramData\BigApp" "D:\BigApp"

Start the application and check it before you delete BigApp.old. The ROBOCOPY Command builder can tune the copy step.

Example 2: game saves into OneDrive. OneDrive does not follow links inside its own folder, so the real data has to live in OneDrive and the link goes where the game expects it. Link: the game’s save folder. Target: the folder inside OneDrive. Open in the builder.

Example 3: one config file shared between two tools. Keep config.json in a versioned folder on D: and link it into the application folder with a file symbolic link. It needs elevation, or Developer Mode. Open in the builder.

Example 4: a stable name for the latest report. A hard link gives D:\Reports\current.csv and this month’s file the same content without a copy. Both must be on D:. Some editors save by writing a new file and renaming it, which breaks the hard link; a script that writes in place keeps it. Open in the builder.

Example 5: a network share inside a local path. An installer only accepts local paths, but the ISO library lives on \\fs01\iso. A junction cannot point there; a directory symbolic link can, from an elevated prompt. Open in the builder.

Other tools


Related guides