The fastest way to free up disk space on Windows is through Command Prompt—no manual file hunting required. This method instantly clears temporary files, recycles bin contents, and scans for large unused files. For most users, running just a few commands will reclaim hundreds of MBs to gigabytes of space.
What You'll Need
- An administrator account (some commands require elevated privileges)
- Windows 10 or 11 (compatible with both versions)
- Command Prompt open as Administrator
- A connection to the internet (some cleanup tools require it)
Step-by-Step
- Open Command Prompt as Administrator
PressWin+Xand select Terminal (Admin) or Command Prompt (Admin). If you're on Windows 11, choose Windows Terminal (Admin) first, then right-click and pick Run as administrator. - Run a basic cleanup with these commands
Type these one after another, pressingEnterbetween each:
net stop winnsi
del /q /f %windir%\winsxs\*
net start winnsi
The last command starts the service again. This removes Windows Update cache files. - Clear temporary files, recycle bin, and old Windows updates
Run these commands for immediate space savings:
echo off | setlocal enabledelayedevaluation & for %%i in (0 1 2 3 4 5 6 7 8 9) do (del /f /q "%temp%\%%i*.tmp" 2>nul)
rd /s /q "%localappdata%\Microsoft\Windows\Temporary Internet Files"
rd /s /q "%localappdata%\Microsoft\Windows\History"
rd /s /q "%localappdata%\Microsoft\Windows\Recent"
del /s /f /q "%userprofile%\AppData\Local\Microsoft\Windows\Recent\AutomaticUpdates"
del /f /q %systemroot%\Recycle.Bin\*.*
These commands delete large temporary files and empty the recycle bin immediately. - Scan for large unused files with Disk Cleanup (optional but thorough)
Typecleanmgr /sageset:1to set a scan scope to just your C: drive. Then run:
cleanmgr /sagerun:1
Follow the prompts to manually select which items to delete, or choose Empty recycle bin and Clean up system files. - Use Windows built-in cleanup tool for deeper analysis
For a more detailed scan that shows actual file sizes, run:
wmic os get TotalVisibleFreeSpace, FreeSpace, FreeSpacePercent
wmic logicaldisk get size,freespace,caption
This shows your current free space and helps identify which drives need attention. - If you have a C: drive with low space, run this to find hidden files
forfiles /path:C:\ /m:* /s /c "if @size>100MB echo @file @size"
This lists all files larger than 100MB on your C: drive.
Common Mistakes
- Running commands without admin rights – Most cleanup commands need elevated permissions. Ensure Command Prompt is opened as Administrator.
- Deleting system files carelessly – The
winsxsfolder contains critical Windows update files. Only delete if you restart after runningnet start winnsi. - Skipping the recycle bin cleanup – Emptying
%systemroot%\Recycle.Bin\*.*immediately frees space that might otherwise be reclaimed later. - Ignoring temporary files in AppData – The
%localappdata%folder contains browser cache, recent documents, and other temporary files that often take up unused space.
Tips
- Run cleanup regularly – Windows users should run these commands at least once a month to prevent disk fragmentation and slow performance.
- Use Shift+Delete for permanent deletion – If you delete files manually, hold Shift while selecting them to skip the recycle bin.
- Check for large files first – If your C: drive is full, the
forfilescommand in Step 6 helps identify which files are consuming the most space. - Combine with Storage Sense – Enable Windows' automatic cleanup in Settings > System > About > Storage to let the system handle temporary files for you.
- Avoid third-party cleanup tools – They may offer unnecessary bloat and can sometimes install malware. Stick to built-in methods.
Troubleshooting
If the commands don't work as expected or your disk space remains unchanged, check these issues:
- Restart your PC – Some temporary files only clear after a reboot. Try again after logging out and back in.
- Check disk permissions – If you get access denied errors, right-click your Command Prompt and select Run as administrator again.
- Verify system file corruption – If
net stop winnsifails, run:
sfc /scannow
Then restart and try the cleanup again. - Use Disk Cleanup GUI for stubborn issues – If commands fail, open Disk Cleanup via Settings > System > About and let Windows guide you through safe deletions.
- Check for disk errors – Run
chkdsk /f C:in an elevated Command Prompt to scan and repair disk errors that may prevent cleanup. - Free up space on other drives – If your C: drive is full, move large files to other drives or cloud storage. The
wmiccommand in Step 5 shows available space on all drives.
Frequently Asked Questions
Does this method work for both Windows 10 and 11?
Yes, these commands work identically on both operating systems. The only difference is how you open Command Prompt as Administrator.
How much space can I expect to reclaim?
Typically, users reclaim between 100MB and 2GB of space after running these commands. Larger amounts depend on how much temporary data was previously cached.
Will deleting system files break my PC?
No, as long as you follow the exact commands and restart after net start winnsi. The winsxs folder contains only Windows update files and can be safely deleted.
What if I get an error about "Cannot delete file"?
This usually means the file is locked by another process. Try restarting your PC first. If that doesn't work, stop any running applications (like browsers) that might be using the file.
Can I automate this cleanup?
Yes, you can schedule these commands to run periodically by creating a batch file and using Task Scheduler. Example batch file:
net stop winnsi
del /q /f %windir%\winsxs\*
net start winnsi
echo off | setlocal enabledelayedevaluation & for %%i in (0 1 2 3 4 5 6 7 8 9) do (del /f /q "%temp%\%%i*.tmp" 2>nul)
rd /s /q "%localappdata%\Microsoft\Windows\Temporary Internet Files"
rd /s /q "%localappdata%\Microsoft\Windows\History"
rd /s /q "%localappdata%\Microsoft\Windows\Recent"
del /f /q %systemroot%\Recycle.Bin\*.*
Save this as cleanup.bat and set it to run weekly.
How do I check if my disk space is actually being freed?
Before and after running the commands, check your available space using wmic logicaldisk get size,freespace,caption. Look for your C: drive in the results.