This one is rather simple given the features of XP CMD.EXE.
@echo off
::
setlocal
:: Get the filenames (one way or the other)
set file1_=%~1
set file2_=%~2
rem set file1_=c:\_d\bas\batfaq2.bat
rem set file2_=c:\_f\xtools\xptd.cmd
::
:: Check for existence
for %%f in ("%file1_%" "%file2_%") do (
if not exist %%f (
echo File %%f not found
goto :EOF))
::
:: Get the filesizes and the datestamps
for %%f in ("%file1_%") do set size1_=%%~zf
for %%f in ("%file2_%") do set size2_=%%~zf
for %%f in ("%file1_%") do set date1_=%%~tf
for %%f in ("%file2_%") do set date2_=%%~tf
::
:: Also get the full file names (optional)
for %%f in ("%file1_%") do set file1_=%%~ff
for %%f in ("%file2_%") do set file2_=%%~ff
::
:: Demonstrate what we've got so far
echo %date1_% "%file1_%" %size1_%
echo %date2_% "%file2_%" %size2_%
::
:: Do the comparison
set same_=false
if "%size1_%"=="%size2_%" if "%date1_%"=="%date2_%" set same_=true
::
:: Display the results
if /i "%same_%"=="true" (
echo The file dates and sizes agree
) else (
echo The file dates and/or sizes do not agree)
endlocal
goto :EOF
The output might be e.g.
C:\_D\TEST>cmdfaq "KOE 2.CMD" "VBSFAQ2.VBS"
12.09.2004 09:28 "C:\_D\TEST\KOE 2.CMD" 817
06.10.2007 09:28 "C:\_D\TEST\VBSFAQ2.VBS" 4084
The file dates and/or sizes do not agree