Background
Running out of space on the C drive is a classic pain point for Windows users. The usual culprits are:
- WeChat/QQ chat history and file caches (easily tens of GB)
- Browser caches and user data
- Global caches from package managers (pip, npm, conda, cargo, etc.)
- Default installation/data directories for Adobe, Office, games, and other large software
- Windows update leftovers and temporary files
Most of these programs default to writing data to the C drive and don’t provide an option to change the path. Reinstalling software or editing the registry is both troublesome and risky.
The mklink command offers an elegant solution — store the data on your D or E drive, while the software “thinks” it’s still on the C drive.
What is mklink?
mklink is a built-in Windows command-line tool (available since Vista) for creating links. It’s essentially a path alias/pointer, similar to Linux’s ln -s.
🧊 Analogy: Think of a desktop shortcut — when you double-click the icon on your desktop, it actually opens a file located elsewhere. mklink does the same thing, connecting the “real storage location” with the “path the software expects.”
Three Types of Links
| Type | Command | Target | Characteristics |
|---|---|---|---|
| Symbolic Link | /D |
Directory | Can cross partitions, most commonly used, like a “directory shortcut” |
| Hard Link | /H |
File | Same partition only, multiple paths pointing to the same data |
| Directory Junction | /J |
Directory | Cross-partition, older NTFS technology, better compatibility |
⭐ For everyday use, prefer
/J(Directory Junction) or/D(Directory Symbolic Link). For moving software data directories, they work almost identically.
Step-by-Step Instructions
Close the Target Software
Make sure the software you’re migrating data from is completely closed (including background processes), otherwise files will be locked and cannot be moved.
Move the Original Folder
|
|
⚠️ Don’t copy! Use move (or cut) to ensure the original path no longer exists.
Create the Link
|
|
Or use /D:
|
|
Verify
Open the original C drive path and confirm you can access the files on the D drive.
🔍 In CMD, navigate to the parent directory and run
dir. Linked items will show the<JUNCTION>or<SYMLINKD>marker.
Common Use Cases
WeChat Data Migration ⭐
WeChat is the number one C drive killer — chat history and file caches can easily reach tens of GB.
|
|
The new version of WeChat stores data at
C:\Users\username\Documents\WeChat Files, while older versions store it in the installation directory underWeChat Files.
QQ Data Migration
|
|
Chrome / Edge Browser Cache
|
|
Development Tool Caches
|
|
A better approach is to configure the package manager’s cache path directly (e.g.,
npm config set cache). Environment variable solutions are more stable, with mklink as a fallback.
Windows Store Apps / Large Games
Some UWP apps and Xbox Game Pass games don’t allow you to change the installation path, but mklink can help migrate them.
|
|
⚠️ Operating on the WindowsApps directory is more complex and involves permission management. Proceed with caution.
OneDrive / iCloud Sync Directories
|
|
Important Notes & Pitfalls
| Issue | Explanation |
|---|---|
| Must move first, then link | mklink requires that the target path does not exist, otherwise it will error File already exists |
| Back up before moving | Although the operation is reversible, it’s recommended to back up important data first |
| Don’t touch system directories | Avoid C:\Windows, C:\Program Files, and other system directories |
| Deleting a link ≠ deleting data | Removing the “shortcut” on the C drive only deletes the link; the data on the D drive remains |
| Correct way to delete a link | rmdir "C:\link-path" (not del) |
| Run CMD as Administrator | Some directories require admin privileges to create links |
| NTFS file system required | Only supported on NTFS, not FAT32 or exFAT |
| Restoring | Delete the link → move the D drive data back to the original C drive path |
Deleting / Restoring a Link
|
|
Quick Diagnosis: What’s Eating Your C Drive?
Before using mklink, analyze your C drive to find the real culprit:
| Tool | Features |
|---|---|
| WizTree | Blazing fast scan, intuitive treemap, free |
| SpaceSniffer | Visual block chart, intuitive |
| TreeSize Free | Classic tool, sorted by folder size |
| Windows Disk Cleanup | cleanmgr, cleans temp files and update leftovers |
🔥 WizTree is recommended — it uses MFT parsing directly, scanning an entire hard drive in seconds.
Summary
The core idea of mklink is:
|
|
The operation mantra: Close the software → Move the folder → Create the mklink link → Verify it works
It’s safer, reversible, and more efficient than “editing the registry” or “reinstalling to another drive.” Master this command, and your C drive will never mysteriously turn red again. 🎉
Further Reading
- Disk cleanup tools: WizTree / SpaceSniffer
- Package manager cache path configuration: npm, pip, cargo official documentation