Not sure what happen to my last reply but here it is again
Thank you for looking at this agerman (after getting a copy of reg.exe from winxp on to this win2k machine the following error came up)
C:\Alert>monitor2
Invalid number. Numeric constants are either decimal (17),
hexadecimal (0x11), or octal (021).
STEST.XML -> older than 17559704 hours
I think this is where it broke due to get a A in the time stamp
C:\Alert\Monitor>(
set "filename=STEST.XML "
setlocal enabledelayedexpansion
call :GetNumberOfMinutes 0 "/" ":" 10/24/07 10:43a FileMinutes
set /a age = CurrentMinutes - FileMinutes
if !age! GTR 60 (
set /a age /= 60
echo !filename:~,40! -> older than !age! hours
)
endlocal
)
As this gives us
set /a hh=10010 % 100, nn=10043a % 100
and this is the cause of the above error
Code: Select all
C:\Alert>REM @echo off &setlocal
C:\Alert>REM folder to be checked
C:\Alert>set "Folder=C:\Alert\Monitor\"
C:\Alert>REM accepted maximum age in minutes
C:\Alert>set "MaxAge=60"
C:\Alert>REM try to change the working directory
C:\Alert>pushd "C:\Alert\Monitor\" || goto :eof
C:\Alert\Monitor>REM read international registry settings
C:\Alert\Monitor>call :GetInternationalSettings DateOrder DateSeparator TimeSeparator
C:\Alert\Monitor>setlocal
C:\Alert\Monitor>for /F "tokens=3" %a in ('reg query "HKCU\Control Panel\International" /v iDate') do set "iDate=%a"
C:\Alert\Monitor>set "iDate=VERSION"
C:\Alert\Monitor>set "iDate=0"
C:\Alert\Monitor>for /F "tokens=3" %a in ('reg query "HKCU\Control Panel\International" /v sDate') do set "sDate=%a"
C:\Alert\Monitor>set "sDate=VERSION"
C:\Alert\Monitor>set "sDate=/"
C:\Alert\Monitor>for /F "tokens=3" %a in ('reg query "HKCU\Control Panel\International" /v sTime') do set "sTime=%a"
C:\Alert\Monitor>set "sTime=VERSION"
C:\Alert\Monitor>set "sTime=:"
C:\Alert\Monitor>endlocal & set "DateOrder=0" & set "DateSeparator=/" & set "TimeSeparator=:"
C:\Alert\Monitor>goto :eof
C:\Alert\Monitor>REM get the current number of elapsed minutes since Jan. 1st 1970, 00:00
C:\Alert\Monitor>call :GetNumberOfMinutes 0 "/" ":" "Wed 01/05/2011" "18:09:21.94" CurrentMinutes
C:\Alert\Monitor>setlocal
C:\Alert\Monitor>set "iDate=0" & set "sDate=/" & set "sTime=:" & set "strDate=Wed 01/05/2011" & set "strTime=18:09:21.94"
C:\Alert\Monitor>for /F "tokens=2" %i in ("Wed 01/05/2011") do set "strDate=%i"
C:\Alert\Monitor>set "strDate=01/05/2011"
C:\Alert\Monitor>for /F "tokens=1-4 delims=/" %a in ("01/05/2011") do (
if 0 == 0 set /a mm=100%a % 100,dd=100%b % 100,yy=10000%c % 10000
if 0 == 1 set /a dd=100%a % 100,mm=100%b % 100,yy=10000%c % 10000
if 0 == 2 set /a yy=10000%a % 10000,mm=100%b % 100,dd=100%c % 100
)
C:\Alert\Monitor>(
if 0 == 0 set /a mm=10001 % 100,dd=10005 % 100,yy=100002011 % 10000
if 0 == 1 set /a dd=10001 % 100,mm=10005 % 100,yy=100002011 % 10000
if 0 == 2 set /a yy=1000001 % 10000,mm=10005 % 100,dd=1002011 % 100
)
C:\Alert\Monitor>for /F "tokens=1,2 delims=: " %a in ("18:09:21.94") do set /a hh=100%a % 100, nn=100%b % 100
C:\Alert\Monitor>set /a hh=10018 % 100, nn=10009 % 100
C:\Alert\Monitor>set /a z=(14-mm)/12,y=yy+4800-z,x=mm+12*z-3,d=153*x+2,d=d/5+dd+y*365+y/4-y/100+y/400-2472633, n=d*1440+hh*60+nn
C:\Alert\Monitor>endlocal & set "CurrentMinutes=21570849"
C:\Alert\Monitor>goto :eof
C:\Alert\Monitor>REM check all files
C:\Alert\Monitor>for /F "delims=" %a in ('dir /a-d /b') do (
set "filename=%a "
setlocal enabledelayedexpansion
call :GetNumberOfMinutes 0 "/" ":" %~ta FileMinutes
set /a age = CurrentMinutes - FileMinutes
if !age! GTR 60 (
set /a age /= 60
echo !filename:~,40! -> older than !age! hours
)
endlocal
)
C:\Alert\Monitor>(
set "filename=STEST.XML "
setlocal enabledelayedexpansion
call :GetNumberOfMinutes 0 "/" ":" 10/24/07 10:43a FileMinutes
set /a age = CurrentMinutes - FileMinutes
if !age! GTR 60 (
set /a age /= 60
echo !filename:~,40! -> older than !age! hours
)
endlocal
)
C:\Alert\Monitor>setlocal
C:\Alert\Monitor>set "iDate=0" & set "sDate=/" & set "sTime=:" & set "strDate=10/24/07" & set "strTime=10:43a"
C:\Alert\Monitor>for /F "tokens=2" %i in ("10/24/07") do set "strDate=%i"
C:\Alert\Monitor>for /F "tokens=1-4 delims=/" %a in ("10/24/07") do (
if 0 == 0 set /a mm=100%a % 100,dd=100%b % 100,yy=10000%c % 10000
if 0 == 1 set /a dd=100%a % 100,mm=100%b % 100,yy=10000%c % 10000
if 0 == 2 set /a yy=10000%a % 10000,mm=100%b % 100,dd=100%c % 100
)
C:\Alert\Monitor>(
if 0 == 0 set /a mm=10010 % 100,dd=10024 % 100,yy=1000007 % 10000
if 0 == 1 set /a dd=10010 % 100,mm=10024 % 100,yy=1000007 % 10000
if 0 == 2 set /a yy=1000010 % 10000,mm=10024 % 100,dd=10007 % 100
)
C:\Alert\Monitor>for /F "tokens=1,2 delims=: " %a in ("10:43a") do set /a hh=100%a % 100, nn=100%b % 100
C:\Alert\Monitor>set /a hh=10010 % 100, nn=10043a % 100
C:\Alert\Monitor>set /a z=(14-mm)/12,y=yy+4800-z,x=mm+12*z-3,d=153*x+2,d=d/5+dd+y*365+y/4-y/100+y/400-2472633, n=d*1440+hh*60+nn
C:\Alert\Monitor>endlocal & set "FileMinutes=-1032011400"
C:\Alert\Monitor>goto :eof
STEST.XML -> older than 17559704 hours
C:\Alert\Monitor>popd
C:\Alert>pause
Press any key to continue . . .
C:\Alert>goto :eof