Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi, I want to a batch script to compare 2 files' timestamp, (in case a process might have died or locked).
please help. Thanks a lot.

Hi George
Something on these lines help.
@echo off
setlocal enabledelayedexpansion
set Count=1rem test files
dir > x1.txt
dir > x2.txtfor /f %%a in ('dir /b x1.txt,x2.txt') do call :Check %%~ta
Rem Remove '/' and ':'
set Stamp1=%Stamp1:/=%
set Stamp2=%Stamp2:/=%
set Stamp1=%Stamp1::=%
set Stamp2=%Stamp2::=%echo %Stamp1%
echo %Stamp2%if %Stamp1%==%Stamp2% (echo OK) else (echo Don't Match)
rem del x?.txt
exit /b
:Check %1 %2
set Stamp!Count!=%1%2
set /a Count+=1
exit /b

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |