Counts files in batch question

June 14, 2009 at 10:09:08
Specs: Windows Vista, 1024
ok i have this code:

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8 >> log.txt

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2 >> log.txt


RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 1 >> log.txt

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 16 >> log.txt
RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 32 >> log.txt

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255>> log.txt

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 4351>> log.txt

How can i get the number of files deleted but each process and loged to a file called "log.txt"


EDIT:


I forgot to mention that im getting the number of file deleted total from this

for /F %%a in ('type "log.txt" ^| find /C /V ""') do set myVar=%%a
ECHO.
echo Number of Temorary Files Deleted:%myVar%

all it does is count the lines in log.txt to tell the user how many was deleted.

id like to do the same for the above processes for XP and VISTA if different.

thank you for your help.


See More: Counts files in batch question

Report •


#1
June 14, 2009 at 13:10:54
@echo off & setlocal > log.txt
set select=8 2 1 16 32 255 4351
echo.
set tot=0
for %%j in (%select%) do (
  RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess %%j > log.tmp
  for /F %%k in ('type log.tmp ^| find /C /V ""') do (
    echo.  Process %%j deleted %%k files
    set /A tot+=%%k
  )
  type log.tmp >> log.txt
)
echo.
echo.  Total files deleted: %tot%
del log.tmp
:: End_Of_Batch

Add/Remove process' number in var select according to your needs.

Report •

#2
June 14, 2009 at 14:34:30
IVO, O


thank you,

im running vista and i tested it it seems to show only 0 file deleted on everything when it should show something. could it be the OS ? i dont know

Thank you tho!!!!


Report •

#3
June 15, 2009 at 03:07:34
Try the script under Windows XP and also see under Vista the size of the log.txt file. If it is 0 (as I suspect) the InetCpl.cpl file performs differently in Vista and XP and in that case I can't modify the script.

Report •

Related Solutions

#4
June 15, 2009 at 19:41:20
Well anyway IVO,

Thank you for your work.


Report •


Ask Question