Mastering mklink: How to Make Windows Behave Like Linux (Sorta)

Ever wish you could trick Windows into thinking your files and folders are somewhere they’re not — without copying a single byte? 😏
Whether you’re syncing game saves to the cloud, taming unruly config files, or just want your OS to behave a bit more like Linux, you’re in the right place.

In this guide, we’ll dive into mklink, one of the most underrated (and wildly useful) tools in Windows.
No fluff — just real examples, practical tips, and the occasional nerdy grin.

Let’s link stuff like pros.

1. What Is mklink and Why Should You Care?

You know how sometimes you want a file or folder to exist in two places at once without actually duplicating it? Or you want a program to think something is in one folder when it’s secretly elsewhere?

Welcome to the magical world of links — specifically, Windows’ built-in tool called mklink.

mklink stands for make link, and it’s a command-line utility in Windows that lets you create:

  • Symbolic Links (aka symlinks): fancy pointers to files or folders
  • Hard Links: more subtle, ninja-like clones at the filesystem level
  • Junctions: shortcut-like links for folders (but much more powerful)

Basically, it’s like creating a shortcut — but it actually behaves like the original file or folder. Programs using the link won’t even know the difference. It’s like tricking Windows into playing your game your way.

Why is it useful?

  • You can redirect where an app saves files, without touching the app
  • Keep game save data in Dropbox/OneDrive to sync across PCs
  • Store huge assets (e.g. VM disks, downloads) on another drive, but still access them from their original location
  • Trick older software into writing to modern folders
  • Create seamless dev/test environments with shared dependencies

Think of it like:

What You WantWithout mklinkWith mklink
Syncing config folder to cloudCopy & paste every timeCreate a symlink once
Game saves backed upManual copyingJust symlink to OneDrive
Legacy app wants C:\DataReinstall app or change codeSymlink C:\DataD:\NewPath
Save disk space with duplicatesMultiple gigabytes usedUse a hard link instead

Real World: Why I Started Using It

In my case? I had a folder of VMware ISOs on my D:\ drive, but wanted to access them from my working scripts in C:\Projects without duplicating anything. Boom — mklink to the rescue.

Up next, we’ll look at the actual syntax and rules — and yes, you do need admin rights (because Windows doesn’t give us symlink power for free 😅).

2. Basic Syntax & Rules

Okay, so now that you’re hyped about what mklink can do, let’s talk about how to use it — without pulling your hair out.

Basic Syntax

CMD
mklink [options] <Link> <Target>

<Link> = the new virtual path you want to create (like a shortcut)

<Target> = the real file or folder you want to point to

Example:

CMD
mklink "C:\Users\Zaur\OneDrive\VMs" "D:\VM-Files"

This tells Windows: “Whenever something accesses C:\Users\Zaur\OneDrive\VMs, actually go to D:\VM-Files.”

But wait — it depends on the type of link you want to make.

All mklink Switches Explained

SwitchLink TypeDescription
(no switch)File symbolic linkDefault; for linking a single file
/DDirectory symbolic linkUsed to link folders (directories)
/HHard linkFor files only; creates a second name for the same file
/JJunctionFor directories; similar to /D, works better for older software

Admin Rights Required!

You must run CMD as Administrator to use mklink. Otherwise, you will get an error:

Quick way:

  • Press Win
  • Type cmd
  • Right-click → Run as administrator

Basic Examples (Real, Copy-Paste-Ready)

➤ Create a symbolic link to a file:

CMD
mklink "C:\Linked\report.txt" "D:\Data\report.txt"

➤ Create a symbolic link to a folder:

cmd
mklink /D "c:\Links\LinkedSource" "D:\Sources\Source"

➤ Create a hard link to a file (must be on the same drive!):

cmd
mklink /H "C:\Data\log.txt" "C:\Logs\server-log.txt"

➤ Create a directory junction (for compatibility):

cmd
mklink /J "C:\OldApp\Config" "D:\AppData\ConfigFiles"

Quick Notes

  • Symbolic links can cross drives or even go to network paths (with care).
  • Hard links must be on the same volume and are only for files.
  • Junctions are more compatible with legacy software and often used by installers (yes, looking at you, Windows).

The takeaway

If you’re linking a folder, start with /D or /J.
If you’re linking a file, go default or /H depending on whether you want symbolic or hard behavior.

3. The 3 Types of Links Explained

If mklink were a tool in your utility belt, it wouldn’t just be a screwdriver — it’d be one of those multi-tools with hidden attachments. Each link type does something slightly different, and knowing when to use which is half the battle.

Let’s break it down.

Created using:

cmd
mklink <Link> <Target>         ← for files  
mklink /D <Link> <Target>      ← for directories

What it does:
Creates a pointer to another file or folder. Think of it like a shortcut that tricks programs into thinking it’s the real thing.

Works across drives? Yes
Works with network shares? Usually, yes (with symlink support)
Visible in Explorer? Yes, shows as a shortcut

🔍 Use when:

  • You want to keep the original file elsewhere
  • You need flexible redirection across disks
  • You’re syncing with cloud storage like OneDrive/Dropbox

Example:

cmd
mklink /D "C:\OneDrive\VMs" "D:\VirtualMachines"

2. Junction (/J)

📌 Created using:

cmd
mklink /J <Link> <Target>

What it does:
Creates a link to a folder only. Acts like a symlink but is more compatible with legacy apps (especially pre-Windows 10).

Works across drives? Yes
For folders only? Yes
Faster and simpler than symlinks? Kind of. It’s native and doesn’t require symlink permissions in older Windows versions.

🔍 Use when:

  • You’re linking folders, and compatibility is key
  • You want to avoid admin permission issues with symlinks

Example:

cmd
mklink /J "C:\Dev\Assets" "D:\GameArt\Assets"

📌 Created using:

cmd
mklink /H <Link> <Target>

What it does:
Creates a second name for a file — not a pointer, not a shortcut — the same actual file with two paths. Delete one, the file still exists.

Files only? Yes
Works across drives? No — must be on the same volume
Visible as a normal file? Yes — even Explorer can’t tell the difference

🔍 Use when:

  • You want to reduce duplication
  • You need an app to access the same file from different paths
  • You want to link logs or output files between folders

Example:

cmd
mklink /H "C:\Logs\latest.log" "C:\App\logfile.log"

Take away

Link TypeFiles?Folders?Cross-Drive?Notes
Symbolic (/D)Flexible and modern (requires admin)
Junction (/J)Good for compatibility
Hard Link (/H)Same file, different name/path

4. Examples You Can Actually Use

The theory is cool and all, but let’s be honest — until you use mklink to solve a real-world annoyance, it’s just another obscure Windows command.

Here are practical, real-world examples where symbolic links, junctions, and hard links can save you time, space, and sanity.

1. Sync Your Game Saves with OneDrive

Problem: You want to back up or sync your game saves with OneDrive, but the game stores them in some obscure location like C:\Users\Zaur\AppData\Local\UltraGame\Save.

💡 Solution: Move the folder to OneDrive and link it back.

cmd
move "C:\Users\Zaur\AppData\Local\UltraGame\Save" "C:\Users\Zaur\OneDrive\UltraSave"
mklink /D "C:\Users\Zaur\AppData\Local\UltraGame\Save" "C:\Users\Zaur\OneDrive\UltraSave"

The game still thinks everything’s in the original location — but it’s secretly syncing to the cloud.

2. Redirect AppData or Config Folder to Another Drive

Problem: Some apps write huge config or cache folders to C:\Users, which fills your boot drive.

💡 Solution: Move that folder to D:\ and create a junction.

cmd
move "C:\Users\Zaur\AppData\Roaming\MyBigApp" "D:\Config\MyBigApp"
mklink /J "C:\Users\Zaur\AppData\Roaming\MyBigApp" "D:\Config\MyBigApp"

Works especially well for Electron apps, dev tools, or noisy loggers.

3. Force Legacy Apps to Use a New Path

Problem: You have a dinosaur of an app hardcoded to write to C:\OldReports, but you want the files stored on D:\ModernStorage.

💡 Solution: Just fake the old path with a symbolic link.

cmd
mklink /D "C:\OldReports" "D:\ModernStorage\Reports"

No need to modify the app — it happily writes to your new location.

Problem: You want the same log file accessible from two different apps or scripts — without duplicating it.

💡 Solution: Use a hard link.

cmd
mklink /H "C:\Shared\Logs\latest.log" "C:\App1\Logs\output.log"

Now both paths point to the same physical file. Deleting one doesn’t delete the data.

Just remember: must be on the same drive!

5. Mirror a Folder for Dev Testing

Problem: You’re testing a new app and want it to read data from your main folder — without copying anything.

💡 Solution: Use a symbolic link or junction.

cmd
mklink /J "C:\TestEnv\Data" "D:\MainEnv\Data"

You get a fully working “copy” of your data — instantly.

Take away:

  • Need compatibility with older apps? → Use a junction.
  • Need flexible file/folder redirection? → Use a symbolic link.
  • Need to reduce duplication of files on same drive? → Use a hard link.

These examples aren’t just nerd tricks — they’re time-saving, sanity-preserving solutions to real IT problems.

5. Common Errors & How to Fix Them

As magical as mklink is, it comes with its fair share of Windowsy weirdness. Let’s look at the most common errors you might encounter, what causes them, and how to get things working again without rage-quitting to Linux.

Error 1: "You do not have sufficient privilege to perform this operation."

💬 Translation:

“Hey, you’re not an admin. Go get some elevated privileges, peasant.”

✅ Fix:

You must run Command Prompt as Administrator to use mklink.

How to:

  • Press Start, type cmd
  • Right-click → Run as administrator

Error 2: "Cannot create a file when that file already exists."

💬 Translation:

“There’s already something sitting at the path you’re trying to link.”

✅ Fix:

  • Make sure the link path (the first argument) doesn’t already exist.
  • Delete or rename the existing file/folder first.

Example:

cmd
mklink /D "C:\Dev\Assets" "D:\Project\Assets"

Will fail if C:\Dev\Assets already exists as a real folder.

Error 3: "The system cannot find the path specified."

💬 Translation:

“Your target path is broken. Did you fat-finger something?”

✅ Fix:

  • Double-check that the target path exists and is correct.
  • Quoting paths with spaces is mandatory.

Correct:

cmd
mklink /D "C:\Link Folder" "D:\Real Folder"

Wrong:

cmd
mklink /D C:\Link Folder D:\Real Folder

💬 Common problem:
You try to create a hard link, and it silently fails or gives vague errors.

✅ Fix:

  • Make sure both files are on the same drive/volume
  • Hard links do not work across drives

💬 Common problem:
You try to create a hard link, and it silently fails or gives vague errors.

✅ Fix:

  • Make sure both files are on the same drive/volume
  • Hard links do not work across drives

💬 Symptom:
You create a symbolic link pointing to a UNC or mapped network drive, and it acts weird or breaks.

✅ Fix:

  • Use mklink on local paths when possible
  • If you must use a network share, ensure symlink support is enabled in Group Policy or use a junction (/J) as a workaround
  • Windows may block UNC symlinks for security

💬 You create a link, but it just looks like a normal folder in File Explorer.

✅ Fix:

  • Use the dir command to confirm it’s a <SYMLINK> or <JUNCTION>
  • Or check with fsutil reparsepoint query <Path>

Take away:

Error MessageWhat’s WrongHow to Fix
Not enough privilegeYou didn’t run as adminRight-click → Run as Administrator
File already existsLink path already existsDelete or rename existing file
Cannot find pathTarget path is wrong or missingCheck for typos & use quotes
Hard link failsSource and link are on different drivesKeep both on the same drive
Symlink to network share failsNot supported or blocked by policyTry a junction or enable policy
Looks like a normal folder in ExplorerWindows hides link info visuallyUse dir or fsutil to inspect

6. Hidden Superpowers & Warnings

So, you’ve seen what mklink can do and probably already thought of five annoying tasks it could make easier. But wait — there’s more. 😎

Like any powerful tool, mklink has some secret talents… and a few sharp edges you should know about before going full Jedi with it.

Superpower 1: Works with Network Shares (Sometimes)

You can link to a network path (UNC path like \\Server\Share) using symbolic links:

cmd
mklink /D "C:\SharedDocs" "\\NAS\Documents"

✅ This can be useful if:

  • You’re working with mapped drives
  • You want to make scripts that work on local and network files identically

⚠️ BUT: Windows may block these by default for security. You may need to:

  • Use Group Policy (gpedit.msc)
    Computer Configuration > Administrative Templates > System > Filesystem
    → Enable “Enable Win32 long paths”

Superpower 2: Use in Scripts or Deployment Tools

You can:

  • Add symlinks during deployment scripts
  • Mirror config trees in CI/CD pipelines
  • Build a versioned folder structure for devs using symbolic links
  • Swap folders dynamically depending on the environment (e.g., Dev vs Prod configs)
cmd
if exist "C:\App\Config\prod.json" (
    mklink /H "C:\App\Config\current.json" "C:\App\Config\prod.json"
)

If CMD isn’t your jam, you can do this in PowerShell:

cmd
New-Item -Path "C:\LinkedFolder" -ItemType SymbolicLink -Target "D:\RealFolder"

Or for junctions:

cmd
New-Item -Path "C:\LegacyApp\Data" -ItemType Junction -Target "D:\AppData\Storage"

Great for scripting or when you don’t want to mess with CMD!

Things to Watch Out For

If you delete the link, the real data remains.
But if you delete the target, the link just becomes a broken shortcut.

❌ Antivirus/Backup Software Quirks

Some AV tools treat symbolic links as suspicious.
Some backup software (looking at you, old school Robocopy) might follow links and copy the data again, creating accidental duplicates.

✅ Always test your backup or AV policies with symlinks in place.

Take aways:

FeatureWorks?Notes
Symlinks to network shares✅*May need Group Policy change
Use in PowerShell scriptsNew-Item supports all link types
Survives rebootsLinks persist like regular files/folders
Portable across systemsNot always — absolute paths may break
Good for backups?⚠️Depends on backup software behavior

7. Bonus Round: PowerShell & Explorer Alternatives

So far, we’ve been hanging out in the world of cmd.exe like it’s 1999. But what if you prefer PowerShell’s modern syntax? Or you want to avoid the terminal entirely?

You’re in luck. mklink isn’t the only way to create links on Windows — there are PowerShell-native methods and even a few Explorer-based tricks that’ll do the job just fine.


PowerShell Way: New-Item to the Rescue

Yep, PowerShell has a native way to create links, and it’s surprisingly clean.


PowerShell
New-Item -ItemType SymbolicLink -Path "C:\LinkedFolder" -Target "D:\RealFolder"

This creates a symlink just like mklink /D, but more readable and scriptable.

PowerShell
New-Item -ItemType SymbolicLink -Path "C:\Linked\notes.txt" -Target "D:\Archive\notes.txt"

✅ Works with relative or absolute paths
✅ Same admin requirement applies
✅ Easier to embed in scripts

Creating a Junction

PowerShell
New-Item -ItemType Junction -Path "C:\LegacyApp\Logs" -Target "E:\AppLogs"

Quick Comparison

ActionCMD (mklink)PowerShell (New-Item)
File symlinkmklink link targetNew-Item -ItemType SymbolicLink
Directory symlinkmklink /DSame as above
Hard link (files)mklink /HNew-Item -ItemType HardLink
Junction (folders)mklink /JNew-Item -ItemType Junction
Needs admin rights✅ Yes✅ Yes

Not natively — but you can do something close with a tiny tweak.

Option 1: Create a Shortcut

  • Right-click → “Create shortcut”
  • Not a real symlink, but works for manual launching

Option 2: Use 3rd Party Tools

Tools like:

These let you create links via right-click from File Explorer — great for folks who fear the CLI.


Take aways:

If you’re scripting: use PowerShell.
If you’re experimenting: use CMD.
If you’re allergic to both: install a GUI helper and go click-crazy.

8. Conclusion: Symlink Like a Pro

If you’ve made it this far — congrats! You now know more about symbolic links, junctions, and hard links than 99% of Windows users. You’ve seen what they are, how to create them, how to use them, and how to fix them when they (inevitably) misbehave.

Whether you’re a developer, a power user, a sysadmin, or just a curious tinkerer, mklink and its cousins are tools you’ll reach for again and again once you realize:

You don’t need to move files around — you just need to trick Windows into thinking you did. 😄

Quick Recap:

  • Use symbolic links when you want flexibility and cross-drive support
  • Use junctions when you’re linking folders and need older app compatibility
  • Use hard links when you want multiple file paths pointing to the same file on the same drive

And if you’re more into clicking than typing, tools like Link Shell Extension make this all accessible with a couple of right-clicks.


Your Challenge:

  • Try replacing a game save folder with a symbolic link to OneDrive
  • Redirect a noisy config folder to a quieter corner of your drive
  • Create a dev workspace where multiple tools read from the same linked files
  • Or just make a shortcut that isn’t a shortcut but still acts like one 😉

Final Words:

Symbolic links aren’t just for devs or hackers — they’re for anyone who wants to be smarter about how they use their storage, organize their apps, or automate their environments.

Now go out there and symlink like a pro.

And if you found this helpful, share it with a fellow IT buddy — or keep it in your bookmarks for the next time Windows tries to tell you where your files should live. 😉

Leave a Comment