Featured image of post C Drive Always Full? Use the Simple mklink DOS Command to Save Your C Drive!

C Drive Always Full? Use the Simple mklink DOS Command to Save Your C Drive!

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.


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.”


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

1
2
# Move/cut the original C drive directory to the target drive
move "C:\original-path" "D:\new-path"

⚠️ Don’t copy! Use move (or cut) to ensure the original path no longer exists.

1
2
# Create a Directory Junction with /J
mklink /J "C:\original-path" "D:\new-path"

Or use /D:

1
mklink /D "C:\original-path" "D:\new-path"

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.

1
2
3
4
5
6
# Close WeChat
# Move the data directory
move "%USERPROFILE%\Documents\WeChat Files" "D:\Data\WeChat Files"

# Create the link
mklink /J "%USERPROFILE%\Documents\WeChat Files" "D:\Data\WeChat Files"

The new version of WeChat stores data at C:\Users\username\Documents\WeChat Files, while older versions store it in the installation directory under WeChat Files.

QQ Data Migration

1
2
3
4
5
# QQ personal folder is usually at
# C:\Users\username\Documents\Tencent Files

move "C:\Users\your-username\Documents\Tencent Files" "D:\Data\Tencent Files"
mklink /J "C:\Users\your-username\Documents\Tencent Files" "D:\Data\Tencent Files"

Chrome / Edge Browser Cache

1
2
3
4
5
6
7
# Chrome user data
move "%LOCALAPPDATA%\Google\Chrome\User Data" "D:\BrowserData\Chrome"
mklink /J "%LOCALAPPDATA%\Google\Chrome\User Data" "D:\BrowserData\Chrome"

# Edge user data
move "%LOCALAPPDATA%\Microsoft\Edge\User Data" "D:\BrowserData\Edge"
mklink /J "%LOCALAPPDATA%\Microsoft\Edge\User Data" "D:\BrowserData\Edge"

Development Tool Caches

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# pip cache
move "%LOCALAPPDATA%\pip\cache" "D:\DevCache\pip"
mklink /J "%LOCALAPPDATA%\pip\cache" "D:\DevCache\pip"

# npm cache
move "%LOCALAPPDATA%\npm-cache" "D:\DevCache\npm"
mklink /J "%LOCALAPPDATA%\npm-cache" "D:\DevCache\npm"

# Maven local repository
move "%USERPROFILE%\.m2\repository" "D:\DevCache\maven"
mklink /J "%USERPROFILE%\.m2\repository" "D:\DevCache\maven"

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.

1
2
3
# For Forza Horizon and similar games
# Usually located at C:\Program Files\WindowsApps or C:\XboxGames
# You'll need to obtain folder permissions (TrustedInstaller) first

⚠️ Operating on the WindowsApps directory is more complex and involves permission management. Proceed with caution.

OneDrive / iCloud Sync Directories

1
2
move "C:\Users\your-username\OneDrive" "D:\OneDrive"
mklink /J "C:\Users\your-username\OneDrive" "D:\OneDrive"

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
1
2
3
4
5
# Delete the link (does NOT delete the original data on the D drive)
rmdir "C:\original-path"

# To restore: move the data back
move "D:\new-path" "C:\original-path"

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:

1
2
3
Software thinks data is still at C:\some-path
       ↓ (the link created by mklink)
Data is actually stored at D:\some-path

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
comments powered by Disqus