How to clean your Windows Temp folder

windows file folder bigger

Krishna Bam asked about cleaning out his temp folder.

As the name implies, the temp folder contains files that are only needed temporally. Unfortunately, these files don't always get deleted after their job is done, resulting in wasted drive space.

To open the temp folder, click Start or go to the Windows 8 Search charm, type %temp%, and select the folder that appears.

[Have a tech question? Ask PCWorld Contributing Editor Lincoln Spector. Send your query to answer@pcworld.com.]

Once there, you can manually delete files and subfolders. But you probably can't delete all of them. Windows won't let you do away with those currently in use. That's fine. You don't want to delete those ones anyway.

In fact, you really don't want to delete any files created since the last time you booted your PC. So if you shut down Windows every night (and I mean shut it down, not sleep or hibernate), and boot clean every morning, you can safely delete any files in Temp not dated today.

Better yet, you can use an old-fashioned, DOS-style batch file to automatically clean out the folder every time you boot. Here's how:

Open Notepad, and type or paste these two lines:

rd %temp% /s /q
md %temp%

0918 save batch file

Save the file as %appdata%\microsoft\windows\start menu\programs\startup\cleantemp.bat. This will create the batch file, cleantemp.bat, inside your Start menu's Startup submenu. Everything in that menu loads automatically when you boot.

Yes, Windows 8 doesn't have a Start menu. But it still has the folder. And the trick still works. Backward compatibility can be a wonderful thing.

To comment on this article and other PCWorld content, visit our Facebook page or our Twitter feed.
Related:
Shop Tech Products at Amazon
Notice to our Readers
We're now using social media to take your comments and feedback. Learn more about this here.