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

Log file from Batch File

Reply to Message Icon

Original Message
Name: wesil
Date: May 2, 2007 at 21:04:03 Pacific
Subject: Log file from Batch File
OS: Windows XP
CPU/Ram: -
Model/Manufacturer: -
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


Report Offensive Message For Removal


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

What's the error?


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

M2



Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Log file from Batch File

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge