Computing.Net > Forums > Programming > Log file from Batch File

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Log file from Batch File

Reply to Message Icon

Name: wesil
Date: May 2, 2007 at 21:04:03 Pacific
OS: Windows XP
CPU/Ram: -
Product: -
Comment:

I created this batch file (XP Cleanup.bat) to faster automate deleting temporary files. I currently have the batch file logging the user, start, and end time of when it ran. I would like to have a more detailed log file. For example how many files from each location were deleted and the time to do it. I am not sure that this is even possible. I found that using the command (dir "%userprofile%\cookies" /b/s /a-d |find /v /c "::" >> Cleanup.txt) would give me the number of cookies/files in the “Cookies” folder. When I try to create a variable with the command (dir "%userprofile%\cookies" /b/s /a-d |find /v /c "::" ) it errors. Can anyone help me?

Thank you.


XP Cleanup.bat
@ECHO OFF

cd "c:\T1"
echo %userprofile:~26% >> Cleanup.txt
echo Start: %Date% %time% >> Cleanup.txt

title Deleting Cookies. . .
cd "%userprofile%\Cookies"
del *.* /F /S /Q /A: R /A: H /A: A
cls

title Deleting Internet History. . .. . .
cd "%userprofile%\Local Settings\History"
del *.* /F /S /Q /A: R /A: H /A: A
rmdir /s /q "%userprofile%\Local Settings\History\History.IE5"
cls

title Deleting Local Temp Files. . .
cd "%userprofile%\Local Settings\Temp"
del *.* /F /S /Q /A: R /A: H /A: A
rmdir /s /q "%userprofile%\Local Settings\Temp"
cls

title Deleting Local Users Temporary Internet Files. . .
cd "%userprofile%\Local Settings\Temporary Internet Files"
del *.* /F /S /Q /A: R /A: H /A: A
rmdir /s /q "%userprofile%\Local Settings\Temporary Internet Files\Content.IE5"
cls

title Deleting Windows Temp Files. . .
cd "C:\WINDOWS\Temp"
del *.* /F /S /Q /A: R /A: H /A: A
rmdir /s /q "C:\WINDOWS\Temp"
cls

title Emptying Recycling Bin...
rem must copy nircmd.exe to System32 folder to work
nircmd.exe emptybin
cls

cd "c:\T1"
echo Finish: %Date% %time% >> Cleanup.txt
echo. >> Cleanup.txt

EXIT


Cleanup.txt
Default
Start: Wed 05/02/2007 21:50:48.78
Finish: Wed 05/02/2007 21:50:48.88



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: May 3, 2007 at 02:31:47 Pacific
Reply:

What's the error?


=====================================
If at first you don't succeed, you're about average.

M2



0
Reply to Message Icon

Related Posts

See More


Create help file Create batch file prompt



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Log file from Batch File

Set date/time of log file as variable www.computing.net/answers/programming/set-datetime-of-log-file-as-variable/20059.html

Telnet from Batch File www.computing.net/answers/programming/telnet-from-batch-file/15212.html

Echo blank line from batch file www.computing.net/answers/programming/echo-blank-line-from-batch-file/13794.html