View Full Version : autoexec.bat question

01-09-02, 09:34 PM
Currently, I have my system set up to wipe out all internet files and temp files at start up with the DEL TREE command in autoexec.bat. My question is, does this do anything more than deleting them in Windows explorer? I know all the index.dat files are modified every time I boot up, and are considerably smaller, but what is the exact difference in how windows deletes these files from DOS or Windows explorer? I also added a couple other directories. Is this totally wiping them out or what?:)

01-10-02, 12:34 AM
Yes, the files you wipe out in Dos are gone, provided you used the correct syntax in the commands you put in the autoexec.bat file.

In Windows, the .dat files are in use, and can't be deleted. In Dos they can be deleted. Windows recreates new ones (bare empty ones) when you reboot. Then starts loading them up with info as you surf again.

deltree /y c:\windows\history
deltree /y c:\windows\cookies
deltree /y c:\windows\tempor~1

These lines will wipe out the entire folders (History, Cookies, and Temporary Internet Files, along with ALL files in them when placed in the autoexec.bat file.
The /y is just to force Dos to NOT explain any errors, if any occur. Explaining errors would stop the bootup process.

01-10-02, 06:37 AM
Actually, mine looks like this:

rem - By Windows Setup - c:\windows\command\mscdex.exe /D:aspicd0 /M:12 /L:I
if exist c:\windows\smartdrv.exe c:\windows\smartdrv.exe 2048 16
DELTREE /y c:\windows\history\*.* > NUL
DELTREE /y c:\windows\tempor~1\*.* > NUL
DELTREE /y c:\windows\temp\*.* > NUL
DELTREE /y c:\windows\cookies\*.* > NUL
DELTREE /y c:\windows\applic~1\micros~1\office\recent\*.* > NUL
DELTREE /y c:\windows\ShellIconCache
if exist del c:\windows\ff*.tmp
if exist del c:\windows\system\advert.dll

So far, all files are history! No pun intended. I thought in order to delete , you would have to over write the files. What does the above entry do that, lets say cleanmgr does not?? I am just curious to know if this is just a automatic way to run cleanmgr, or is the data truely no longer on the hard disk?

01-10-02, 08:35 AM
Let me do a breakdown of what isn't right with your method, and what is.

@ECHO OFF (ok but hides what's happening)
rem - By Windows Setup - c:\windows\command\mscdex.exe /D:aspicd0 /M:12 /L:I (can be removed, it's not doing anything)
PATH=%PATH%; (not needed, wasting time)
if exist c:\windows\smartdrv.exe c:\windows\smartdrv.exe 2048 16 (smartdrv.exe does exist, no need for 'if exist')
DELTREE /y c:\windows\history\*.* > NUL (probably better than my method assuming >nul actually overwrites the files)
DELTREE /y c:\windows\tempor~1\*.* > NUL (ditto)
DELTREE /y c:\windows\temp\*.* > NUL (this line will cause problems if you install any programs that use the temp dir to place a file to finish the install after a reboot))
DELTREE /y c:\windows\cookies\*.* > NUL (ditto on the >Nul))
DELTREE /y c:\windows\applic~1\micros~1\office\recent\*.* > NUL
DELTREE /y c:\windows\ShellIconCache (only needed if your icons are screwed up)
if exist del c:\windows\ff*.tmp (should read - if exist c:\windows\*.tmp del c:\windows\*.tmp) - the del command comes after the file name(s), and you may as well delete ALL tmp files instaed of just those that start with ff)
if exist del c:\windows\system\advert.dll (same here) (should read - if exist c:\windows\advert.dll del c:\windows\advert.dll

Cleanmgr can't delete files in use by windows, so all .dat files remain - and are hidden from site even if 'show all files is set

Deleted files on the HD remain on the HD untill overwritten, but even if overwritten they can still be extracted by certain technical processes. I believe it takes 7 overwrites or more to wipe the HD to the point no files can be retrieved. If you're worried about files that are/were on your HD that could cause you legal grief, destroy the HD to be absolutely sure no files can be retrieved.

I have all my IE cached files go to a ramdrive, and that gets wiped clean when the power goes off.

01-10-02, 09:52 AM
I have my reasons for doing it the way I did. It works absolutly fine. There is nothing illegal on my drive, but whats the point of deleting if the file still exists

one more thing, the line under echo off, was there prior

01-10-02, 12:24 PM
Sorry to rain on your parade but some of the syntax you are using WON"T work, but hey, if you think it works who am I to argue with you. :)

if exist del c:\windows\ff*.tmp won't work no matter what you think. The del command has to go after the file name and the file name has to be repeated after the del command.

I'm just trying to help, that's all.

The line under ECHO was made when you upgraded from Win95 to Win98 right? It is to install a Dos driver to run your CDRom, but Win98 doesn't need it, so the statement gets rem'd out, and is just wasting space now. It won't hurt anything though.

I was in a hurry typing this, I don't mean to flame if I came across that way.


01-10-02, 12:37 PM
Sure DOS master