Your hard drive is almost full and you have no idea why. You haven’t downloaded movies, you don’t store massive photo libraries, and yet Windows keeps warning you about low disk space. Welcome to the club. The culprit is almost always the same: temporary files, cache, and leftover junk that Windows accumulates without asking. The good news is you don’t need a paid cleaner app to fix this. A couple of CMD commands will do the job faster and cleaner than any third-party tool.
What exactly are temporary files filling up your disk?
Every time you open a browser, install a program, or run an app, Windows creates temporary files. Some are installer leftovers, some are app cache, some are logs nobody reads. These temp files pile up in folders like %TEMP% and C:WindowsTemp, and they can easily eat several gigabytes over a few months.
The tricky part: Windows doesn’t clean them automatically as often as people assume. Storage Sense helps, but it’s conservative. So if you’re asking why your disk is full when you «haven’t done anything», the answer is usually a silent mountain of temp files and cache.
In my experience, a typical Windows 10 or Windows 11 machine that hasn’t been cleaned in a year can have between 5 GB and 20 GB of pure garbage sitting there. That’s a lot of space recovered for free.
The fastest CMD command to delete temporary files
Open Command Prompt as administrator. Not the normal one — you need admin rights, otherwise some files won’t budge. Then run this:
del /q/f/s %TEMP%*
Let’s break down what that command to delete temporary files actually does. /q runs it in quiet mode (no confirmation prompts), /f forces deletion of read-only files, and /s applies it to all subfolders. The %TEMP% variable points to your user’s temp folder.
One honest warning: some files will fail to delete because they’re in use by running apps. That’s normal. Close your browser, Spotify, and anything else, then run it again. Don’t panic if you see «access denied» errors — it’s not breaking anything.
If you want to go further, you can also nuke the system temp folder:
del /q/f/s C:WindowsTemp*
Same rules apply. This one needs admin rights for sure.
Prefer clicking instead of typing? Use Disk Cleanup
Not everyone is comfortable with the command line, and that’s fine. Just run:
cleanmgr
That opens the classic Disk Cleanup tool. From there you can select what you want to wipe: temporary internet files, thumbnails, delivery optimization files, old Windows updates, recycle bin contents. It’s slower than CMD but more visual, and it lets you see exactly what you’re deleting.
My honest take: Disk Cleanup is safer for beginners, but it’s also more limited. It won’t touch certain cache folders that a direct CMD command will. If you want maximum cleanup with minimum effort, combine both. Run cleanmgr first, then hit the CMD commands.
Don’t forget the DNS cache — the invisible space thief
This one catches people off guard. The DNS cache doesn’t take much disk space, but it does cause connection issues and weird browsing behavior. Clearing it is a two-second job:
ipconfig /flushdns
This command clears the DNS cache in Windows 10 and Windows 11. You’ll see a confirmation message saying the DNS resolver cache was flushed successfully. Use it whenever a website refuses to load, or after changing DNS servers.
Is it strictly about freeing disk space? Not really. But it’s part of the same maintenance routine, and it keeps your system snappy. Think of it as cleaning the pipes, not the storage room.
Other cache commands worth knowing in 2026
There’s more than one cache on your PC. If you want a proper cleanup, these are the ones I actually use:
- ipconfig /release and ipconfig /renew — refresh your IP configuration.
- sfc /scannow — scans and repairs corrupted system files, often caused by junk buildup.
- DISM /Online /Cleanup-Image /RestoreHealth — fixes the Windows image when sfc can’t.
- rd /s /q %temp% — deletes the entire temp folder (it gets recreated automatically).
The rd command is more aggressive than del. It removes the folder itself rather than just the files inside. Windows rebuilds it the next time it’s needed, so it’s safe in practice. Still, don’t run it on anything other than %temp%.
How often should you actually do this?
Once a month is more than enough for a normal user. If you install and uninstall software regularly, or you’re a gamer with multiple launchers, every two weeks makes sense. Running these CMD commands daily is overkill and won’t give you any extra benefit.
What you should do daily is close apps properly instead of leaving 40 tabs open for weeks. That’s the real source of temp file buildup. The commands just clean up the mess afterwards.
One more thing people get wrong: deleting temp files won’t speed up your PC dramatically by itself. If your machine is slow, the problem is usually RAM, an old hard drive, or startup bloat. Temp cleanup helps, but it’s not magic. Anyone promising a «10x faster PC» from one command is selling you smoke.
Is it safe? Yes, with common sense
These commands to delete temporary files and clear cache are safe for your Windows installation. Nothing critical lives in %TEMP%. But there are exceptions worth knowing:
- Don’t delete files while a program is installing — you might break the installer.
- Don’t touch folders outside %TEMP% and C:WindowsTemp unless you know what you’re doing.
- If a game or app stores saves in a temp-like folder (rare but happens), back up first.
Other than that, you’re good. No registry hacks, no third-party cleaner subscriptions, no shady «optimizer» software that installs five toolbars. Just plain Windows tools that have been there for decades and still work in 2026.
Run the commands, check your free space before and after, and you’ll see the difference immediately. It’s the cheapest upgrade your PC will ever get.