Default
Google

avoid navigation

Empty Windows' Temp folder

An MS-DOS batch file to delete the contents of Windows' Temp folder.

Contents

  1. Introduction.
  2. Listing of this batch-file.

Introduction

Every now and then you may want to clear out Windows' temporary folder. All kinds of programs leave files in it, and they can take up quite a lot of hard-disk space. A way of automating the deletion process would be very useful.

Like most of the batch-files listed on this site, this comes under the heading of generic. This one, however, is the first one sent to me for inclusion on this site. So a big thank-you goes out to my good friend; you know who you are <grin>.

Back to Contents.

Using this batch-file

Although you can run this batch-file whilst in Windows, there is a reason why this might not be the best idea. If a program has a file open in the temporary folder then the batch-file will stop running and return an error when it encounters the open file.

I'd recommend that you run this from real DOS, which basically means that you shut-down Windows and Restart the computer in DOS mode. When you get to the DOS prompt you will need to type the name of the batch-file and press enter.

Back to Contents.

Listing of this batch-file

@echo off
:: DelTemp.bat            ::
::                        ::
:: Delete the contents of ::
:: Windows' Temp folder   ::
@cd\
@attrib -r -a -s -h c:\windows\temp\*.* /s
@deltree c:\windows\temp
@mkdir c:\windows\temp

Back to Contents..



Acquiring image from ProHosting Banner Exchange