Solved this batch file gives odd results after 3 runs

October 28, 2013 at 14:11:49
Specs: Windows Vista
@echo off & setLocal & color e0
MODE CON:cols=78 lines=18
title Howmany files removed/added without your knowledge or permission ?
echo. by Eddie Duncan_Dunlop Ver 3.1

set /p old=<%temp%\store.txt
if not exist %temp%\list.txt echo (run twice first time)
if "%old%"=="" set old=0
cls & echo.
echo. Wait making a list of all the files currently on your hdd C:\
dir c:\*.* /b /a /s /o:D /c >%temp%\list.txt

echo.& echo. Wait counting the list of how many files were found
set count=0 & :: by Eddie Duncan_Dunlop Ver 3.0

for /f %%n in (%temp%\list.txt) do set /a count+=1
if not exist %temp%/store.txt echo 1>%temp%/store.txt
echo %count%>%temp%/store.txt
set /a differ=%count%-%old%
echo %date% %time% Lastcount was %old%,new count=%count%, Difference = %differ% >>%temp%\results.txt
echo mt>%temp%\list.txt
start %temp%\results.txt

message edited by eddiedd

See More: this batch file gives odd results after 3 runs

Report •

October 28, 2013 at 18:56:15
✔ Best Answer
The first, and (imo) most relevant concern is that IF the computer is used for internet access, the file-count would be totally meaningless, due to browser caching. At least with IE, I know such comparisons would be worthless. Second, without a comparison of "benchmark" or previous fileset, and current fileset, I don't see how this could solve anything, because there is no data as to files removed and files added (not to mention files changed!). File names have no relevance, only file content. Many virus' do their work by substituting viral content for main-line DLL and .EXE files. If nothing else, I would suggest avoiding or otherwise handling cache and temp files, and using FSUM (compare previous to current) instead of just a dir. listing to test files integrity.
And then there's registry alterations to track as well...

message edited by nbrane

Report •
Related Solutions

Ask Question