Page 1 of 1

deleting Temp folder and temporary inet folder

Posted: 25 Nov 2009 19:56
by ckolbas
Hello everyone! I am fairly new at this so please be patient with me. I am trying to get a script to run that will delete my temp folder and temporary internet folder. I know that it is possible that you can create it so that you can type the file name and then multiple users on that computer and it will work. I.E. del.bat %username% %username% ...

Also does anyone know if you can echo a certain line from 2.bat and put it in 1.bat? I.E. I just want to echo my IP address.

Anyhelp on this would be appreciated!

Thanks!
ckolbas

Posted: 02 Dec 2009 11:27
by BILL Dos
What OS are you using?
Here's a working code that works for me when doing a clean install of XP.

Code: Select all

@ECHO OFF
REM Automatically clean-up "Temp" , "Internet" and "History" files.

Rem Gives Full Rights to ALL "Local Settings" Folders.
ECHO Y| cacls "%systemdrive%\Documents and Settings\Administrator\Local Settings\*.*" /G Administrator:F"
cacls "%systemdrive%\Documents and Settings\Administrator\Local Settings\*.*" /E /G %username%:F

Rem Rights to "History" folder.
ECHO Y| cacls "%systemdrive%\Documents and Settings\Administrator\Local Settings\History\*.*" /G Administrator:F"
cacls "%systemdrive%\Documents and Settings\Administrator\Local Settings\History\*.*" /E /G %username%:F

Rem Rights to "Temp" folder
ECHO Y| cacls "%systemdrive%\Documents and Settings\Administrator\Local Settings\Temp\*.*" /G Administrator:F"
cacls "%systemdrive%\Documents and Settings\Administrator\Local Settings\Temp\*.*" /E /G %username%:F

Rem Rights to "Temporary Internet Files" folder.
ECHO Y| cacls "%systemdrive%\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\*.*" /G Administrator:F"
cacls "%systemdrive%\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\*.*" /E /G %username%:F

Rem Rights to "Temp" folder in Windows.
ECHO Y| cacls "%windir%\Temp\*.*" /G Administrator:F"
cacls "%windir%\Temp\*.*" /E /G %username%:F

Rem Clean out files in "Offline Web Pages" and "%TEMP% folder in Local Settings.
del "%TEMP%\*.*"/q /f
del "%windir%\Offline Web Pages\*.*"/q /f

Rem Clean out "History","Temp" and "Temporary Intenet Files" Folders.
rd /s/q "%systemdrive%\Documents and Settings\Administrator\Local Settings\History"
rd /s/q "%systemdrive%\Documents and Settings\Administrator\Local Settings\Temp"
rd /s/q "%systemdrive%\Documents and Settings\Administrator\Local Settings\Temporary Internet Files"
rd /s/q "%windir%\Temp"

Rem Making new "Temp" folders.
mkdir "%systemdrive%\Documents and Settings\Administrator\Local Settings\Temp"
mkdir "%windir%\Temp"

EXIT