What does the batch file do? The first line has the command cls
. cls
clears the screen window of any previous data. The next three lines start with REM
for "remark." Lines begining with REM
do not contain commands, but instructions or messages that will be ed for the user. The next two lines begin with the command deltree
, deltree
not only deletes files but directories and sub-directories. In this case the file is deleting the directory cookies
and all the files inside. This directory is automatically rebuilt. The deltree
has been passed the parameter /y
, this informs the process to answer "YES" to any confirmation questions. Sometimes you type the DEL
or one of its cousins, the system will ask "Are sure you want to do this?" setting /y
answers these prompts without interupting the process. The pause
command halts the process temporarily and shows the users a list of all the files being deleted. cls
clears the screen again, another REM
line tells the user that the files are deleted. The last line contains only :end and returns the process to the command prompt. This version was created to show the user everything that is taking place in the process. The version bellow does the same thing without showing the user any details.
cls
@echo off
deltree /y c:\windows\cookies\*.*
deltree /y c:\windows\tempor~1\*.*
cls
Without REM
lines there are no comments. The @echo off
command keeps the process from being "echoed" in the DOS window, and without the pause
and :end lines, the process runs and exits without prompting the user. In a process this small it is okay to have it be invisible to the user. With more a complex process, more visual feedback is needed. In computing there is fine line between too much and too little information. When in doubt give the user the oportunity to see what is going on.
This version is a little more thurough, deletes alot of junk
cls @ECHO OFF ECHO. *********************************** ECHO. ** Clean Cookies and Temp Files ** ECHO. ** Will not work in NT ** ECHO. ******************************* deltree /y c:\windows\cookies\*.* deltree /y c:\windows\tempor~1\*.* deltree /y c:\progra~1\Netscape\Users\default\Cache\*.jpg deltree /y c:\progra~1\Netscape\Users\default\Cache\*.gif deltree /y c:\progra~1\Netscape\Users\default\Cache\*.htm deltree /y c:\progra~1\Netscape\Users\default\archive\*.htm deltree /y c:\progra~1\Netscape\Users\default\archive\*.gif deltree /y c:\progra~1\Netscape\Users\default\archive\*.jpg deltree /y c:\windows\temp\*.* deltree /y c:\temp\*.* deltree /y c:\windows\Recent\*.* deltree /y c:\recycled\*.* cls EXIT
|
"C:\windows\history\today" will rebuld itself if you delete it. It"s not a file, it"s a specially configured directory structure that DOS doesn"t see the same way that windows does. C:\windows\history\today doesn"t actually exist as DOS sees it. Go into the C:\windows\history directory and type DIR/A this will show you the hidden directories and how they are named.
WINNT Version
@ECHO OFF ECHO ************************************************** ECHO ** DEL replaces DELTREE, /Q replaces /Y ** ECHO **************************************************
del /Q c:\docume~1\alluse~1\Cookies\*.* REM Change alluse~1 in the above line to your userID del /q c:\winnt\temp\*.* del /q c:\temp\*.* del /q c:\winnt\Recent\*.* del /q c:\*.chk EXIT
|
Add these lines for XP - Provided by Patrick R.
del /q C:\Windows\Temp\Adware\*.* del /q C:\Windows\Temp\History\*.* del /q C:\Windows\Temp\Tempor~1\*.* del /q C:\Windows\Temp\Cookies\*.*
|
One thing I do quite often is erase old floppy disks. I might have a stack of them and I don"t care what"s on them, but I want all the files gone including potential virii(everyone says "viruses" but "virii" is the proper term. Snob!). But I get tired of opening a DOS prompt and typing in the command to format the disk. So I wrote a one line batch file that does it for me. Save it as: "disk_wipe.bat"
Put a disk in the drive and double-click the .bat file icon.
Batch File Utilities and Commands
Any valid DOS command may be placed in a batch file, these commands are for setting-up the structure and flow of a batch file.
CLSClears the screen