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 browserStart from a common task
In PowerShell, run it as cmd /c mklink ... or use the PowerShell command below.
mklink fails if the link path already exists. Delete or rename it first.
How to use
- 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.
- Link is the new name you are creating. It must not exist yet.
- Target is the file or folder that already exists and holds the real data.
- Read the confirmation line under the output: “Creates a junction at … that points to …”. If it reads backwards, swap the two fields.
- Fix anything flagged in red or amber. Where the fix is a different link type, one click switches it.
- 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.
- Use Share link to send the exact command to a colleague or save it in a ticket.
Which link type to choose
All four types live on NTFS. The difference is what they can point to and who can create them.
| Type | Flag | For | Target can be | Needs admin | Network target |
|---|---|---|---|---|---|
| Directory junction | /J | Folders | Any local drive | No | No |
| Directory symbolic link | /D | Folders | Anywhere, including UNC | Yes* | Yes |
| File symbolic link | none | Files | Anywhere, including UNC | Yes* | Yes |
| Hard link | /H | Files | Same volume only | No | No |
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.
For a local folder, use a junction. It needs no elevation and almost every program follows it transparently. Choose a directory symbolic link when the target is a UNC path such as \\fs01\share, or when the link must hold a relative path. A junction always stores an absolute path.
Symbolic links need an elevated Command Prompt unless Developer Mode is on. Junctions and hard links do not. Either run the command as administrator, switch to a junction for a local folder, or enable Developer Mode on a workstation you control.
The link path already exists. mklink never overwrites. Rename the existing folder (for example to BigApp.old), create the link, check that the program works, then delete the renamed copy.
mklink is built into cmd.exe, not a separate program. In PowerShell, run cmd /c mklink ... or use the New-Item line the builder shows. Note that Windows PowerShell 5.1 expects a full target path; relative targets for folder symlinks arrived in PowerShell 7.1.
Remove a folder link with rd "C:\Link", without /S. Remove a file link with del "C:\Link\file.txt". The target stays where it is. Check what you are about to delete with dir /AL first. The full procedure, including the commands that do reach the target, is in How to delete a symbolic link on Windows without deleting the target.
No. Junctions, symbolic links and hard links need NTFS. FAT32 and exFAT, the usual formats for USB sticks and SD cards, reject all three.
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.
Useful links
- mklink command reference (Microsoft Learn)
- New-Item: SymbolicLink, Junction and HardLink item types
- Hard links and junctions (Win32 documentation)
- Enable Developer Mode in Windows
Other tools
- ROBOCOPY Command builder: copy or move the data before you link it
- Windows 11 registry tweak generator: ready-made .reg files for common workstation changes
- All system tools
Related guides
- mklink in Windows: symlinks, junctions, and when to use each: the command in depth, with common errors and how to fix them.
- NTFS links on Windows: symbolic links, junctions, and hard links compared: the three link types side by side, and when each one fits.
- How to move AppData folder to another drive on Windows: the full procedure for moving AppData with a junction.
- How to sync game saves to the cloud on Windows using mklink: step-by-step setup with a cloud-synced folder.
- How to list all symbolic links on Windows: find existing links before you create or remove one.