Use the Command Line for a Quick Cleanup of Windows Temp Files


The previous tip showed how to configure Windows Disk Cleanup to reduce the time that temp files are kept. A simple approach that allows the deletion of temp files right away uses the Windows command line and the environment variable %TEMP%. Open the command line and enter:

   del /q/f/s %TEMP%\*

One precaution to observe: do not apply this command right after installing updates or new programs that require a reboot. Sometimes these processes use temp files to finish installation.

Get your own favorite tip published!  Know a neat tech tip or trick?  Then why not have it published here and receive full credit?  Click here to tell us your tip.

This tips section is maintained by Vic Laurie. Vic runs a Windows blog called The PC Informant and also operates a computer education website.

Click here for more items like this. Better still, get Tech Tips delivered via your RSS feeder or alternatively, have the RSS feed sent as email direct to your in-box.

Please rate this article: 

Your rating: None
Average: 4.1 (34 votes)


I was having around 135000 temp files in my pc, which was slowing down my pc speed performance. I used the command option of your article and deleted the temp files at one chance. It was really helpful , nice and as well as informative. Thanks.

i have got some folders in temp cmd but some folders can't be deleted ,but how to delete that files

The files are probably in use or locked by some program. Unless they are taking up a lot of space, they can be probably be left alone.