# Autoexec.bat TIP



## SeksiYANK (Mar 15, 2005)

If you want to clear internet privacy files(Such as history, cookies, and temp files) automatically on startup, you can simply add this text to your autoexec.bat file:

@ECHO OFF
IF EXIST C:\WINDOWS\SMARTDRV.EXE C:\WINDOWS\SMARTDRV.EXE 2048 16
IF EXIST C:\WINDOWS\TEMP\*.* DELTREE /Y C:\WINDOWS\TEMP\*.* > NUL
IF EXIST C:\WINDOWS\COOKIES\*.* DELTREE /Y C:\WINDOWS\COOKIES\*.* > NUL
IF EXIST C:\WINDOWS\RECENT\*.* DELTREE /Y C:\WINDOWS\RECENT\*.* > NUL
IF EXIST C:\WINDOWS\HISTORY\*.* DELTREE /Y C:\WINDOWS\HISTORY\*.* > NUL
IF EXIST C:\WINDOWS\TEMPOR~1\*.* DELTREE /Y C:\WINDOWS\TEMPOR~1\*.* > NUL

This will erase you internet history files on startup. You can also add other batch statements to be executed on startup here. Be creative! 

I'm sure many of you already know about the autoexec file, but many don't, and it beats using a 3rd party application taking up more resources, IMO.

Beware, this will delete all your cookies, history, temporary internet files, and recent documents. And yes, unless you shred these files it is possible for them to be recovered(Shred those porn cookies!  ).

-JC


----------



## blues_harp28 (Jan 9, 2005)

Looks like an interesting tip,but remember Win98 does not need Autoexec.bat at start
up..


----------



## WhitPhil (Oct 4, 2000)

Also remember that there "may be" files in the \Temp folder that are part of an install, and are expected to be there after the required boot.


----------



## blues_harp28 (Jan 9, 2005)

That's interesting WhitPhil,many are advised to clear all temp files regularly, and may think that includes temp folders.maybe clarification is needed..


----------



## WhitPhil (Oct 4, 2000)

There is no issue with the general clearing of \Temp files. 

But, using the Autoexec to do it, means the files are being deleted at boot time.

If you just did an install, that placed files in \Temp folder and then asked you do do a reboot, the Autoexec would now delete them, before the install process was able to do, whatever it needed to do, with these files.


----------



## SeksiYANK (Mar 15, 2005)

Yeah, that is a problem whitphil.

If you don't want your \Temp files being deleted, simple edit out the 2 lines which delete it.

And yes, this only works for WinXP.


----------



## JohnWill (Oct 19, 2002)

Of course, you can also run scripts (batch files) when you startup or shutdown using group policies. I also use a temp clearing utility to clean a variety of temp files when I boot.


----------



## OBP (Mar 8, 2005)

You have forgotten the single most important file on the computer.
INDEX.DAT, it holds every website/page/gif etc that you have ever viewed in Internet Explorer.


----------



## JohnWill (Oct 19, 2002)

Why is INDEX.DAT so important? I'm not ashamed of visiting Tech Support Guy, shucks, I'm even a moderator here.


----------



## Bold_Fortune (Jan 3, 2003)

I don't think XP uses AUTOEXEC.BAT.

There's all sorts of stuff about it in a Google search.

http://www.google.com/search?hl=en&q=AUTOEXEC.BAT&btnG=Google+Search


----------



## OBP (Mar 8, 2005)

JohnWill, it is so important not only as a security issue but because it just keeps growing, there is no way to clear it in normal Windows programs.


----------



## SeksiYANK (Mar 15, 2005)

Bold_Fortune said:


> I don't think XP uses AUTOEXEC.BAT.
> 
> There's all sorts of stuff about it in a Google search.
> 
> http://www.google.com/search?hl=en&q=AUTOEXEC.BAT&btnG=Google+Search


-_- By default there is nothing in AUTOEXEC.BAT.

Why something only available in XP, that works for me and millions of others not work?


----------



## WhitPhil (Oct 4, 2000)

SeksiYANK said:


> -_- By default there is nothing in AUTOEXEC.BAT.
> 
> Why something only available in XP, that works for me and millions of others not work?


What you have posted will definitely work in Win9x, but not in XP.


----------



## JohnWill (Oct 19, 2002)

Actually, there's no reason that stuff in the AUTOEXEC.BAT file won't work with XP, it will be executed. OTOH, you can simply put a shortcut to a batch job in your startup group and it'll do the same thing.


----------



## WhitPhil (Oct 4, 2000)

John:

A couple of reasons why I don't believe those commands will work.

1. Autoexec (on my PC at least) is not "executed" at boot time. This seems to be substantiated by the MS notes on Clean boot processing and Startup Troubleshooting, where there are no references to the file.

2. Even *if* the file were being processed, it would not do as advertised since the locations referenced for History, TIF, etc are those of Win9x, not XP.


----------



## JohnWill (Oct 19, 2002)

Well, the references to W98 are a problem, I confess I didn't check those! 

You might want to check your facts about AUTOEXEC.BAT being processed, because it sure is on my XP-Pro systems. I have a few vestages from the past still living in the AUTOEXEC.BAT on several systems, and they certainly get run every boot. To whit:

I have the line:

SET FULTEMP=C:\TEMP

... in my AUTOEXEC.BAT on this machine. When I check the environment, that variable is indeed there. Also, here's this procedure for setting some environment variables for JAVA, and their alternative method at the bottom of the page is to use AUTOEXEC.BAT.

However, I believe that only SET and PATH commands are processed, so in this discussion, you probably still win.


----------



## WhitPhil (Oct 4, 2000)

Yes, I think you are right. That's why I said "executed" (in quotes) in my post.

I think XP actually "processes" the file, but only parses out and keeps (in the registry) environmental variables.


----------



## monkeymoon (Jan 21, 2005)

On my Win98, autoexec.bat isn't executed, either.


----------



## JohnWill (Oct 19, 2002)

Well, I have to disagree with you there. I know for 100% certain that commands in the AUTOEXEC.BAT file in the root of the boot drive will indeed get executed running W98 or W98SE!


----------



## blues_harp28 (Jan 9, 2005)

Thats interesting JohnWill, I have win98se and on suggestions from this forum both Autoexe Bat and Config Sys where all unchecked 2 months ago and my system has run with no problems.
Would be good to know which would be correct..


----------



## WhitPhil (Oct 4, 2000)

By default, Win98 does not require either of those files.
BUT, if they are present in the root of the Windows drive, they will in fact be used.

Common uses would be to run a (DOS level) Virus check at boot time, to run (or setup) any other required DOS app or environment, or to enable the use of the CD drive at the DOS level.


----------



## blues_harp28 (Jan 9, 2005)

Thanks WhitPhil for clarifiying that, now I know..
Cheers. 
:up:


----------



## monkeymoon (Jan 21, 2005)

I have my autoexec.bat unchecked is what I meant. Sorry, didn't mean it doesn't exist. Just that I unchecked it two years ago when I had trouble with my machine when I was trying selective start-up. Still runs fine with it unchecked is what I meant.


----------



## JohnWill (Oct 19, 2002)

Yes, I never said you needed them, only that they would be used if present.


----------



## monkeymoon (Jan 21, 2005)

I just run CCleaner ( Crap Cleaner ) once a day and it deletes all the junk you mentioned and ALSO DELETES INDEX.DAT.


----------

