Next Generation Emulation banner
1 - 20 of 20 Posts

Asz

· Registered
Joined
·
1,790 Posts
Discussion starter · #1 ·
Does anyone know how to make a .bat file that deletes everything in a certian directory? I want to make one that starts everytime I start my computer and deletes my TEMP folder because nothing in there is being used by anything and I know it. Anyone?
 
Hmm, I have Autoexec.NT in system32, but that's it...
 
The autoexec for WinXP is hidden. You just go to tools, folder options, and disable 'Hide-Protected System Files'
 
Using Pro. You have enable show hidden, etc, and the show system files? they are 2 different things.
 
Following on Beta's footsteps, if you want to get rid of the empty folder as well, make a substitution of that line for:

deltree C:\TEMP

Yet assuming the TEMP dir is C:\TEMP.

There are other codes just to make the script fancy, but are interesting to know:

echo off - in a single line, disables the screen log of the next batch commands you have written after this, until you switch it to "on".
echo "put your favorite text here" - (without the quotes) displays text in a single line. If larger than screen, text is automatically wrapped.
@ "any command" - (without the quotes) same as "echo off", but using this you hide only this command.
pause - prompts a default text requesting any input (eg. pushing a keyboard key) from the user in order to continue the batch workflow. Can also be used with text after the "pause" command.

There are even other options if you want to go a little bit far on programming batch language, but this is definitely not my area of expertise. :p Anyway, here's an example:

IF EXIST C:\TEMP GOTO "TEMPDEL"
IF ERRORLEVEL 2 GOTO "EXIT"

:TEMPDEL
deltree C:\TEMP

:EXIT
win

This can be wrong, I believe there's some order to be followed. Anyway, that should be enough for your needs. :p ;)
 
Originally posted by ShADoWFLaRe85
Uh...why not just tell notepad to open c:\autoexec.bat??? Should work either way. If it doesn't exist, create one. :p
I doubt that would work for XP since it's based on the NT kernal and doesn't have DOS in the background while windows boots up. With WinNT(Win2k, XP), it doesn't load up a config.sys and autoexec.bat (I don't think it does anyways). If I'm wrong please tell me cause I don't want to accidentally give out false info. :D
 
I dont think winXP run the autoexec.bat file when booting. Only win9x do that.
 
1 - 20 of 20 Posts