I have the below batch file to compare the date of a flag file to the system date and shut down a program if the flag file is the same date as the system date, or check to see if the flag file has been updated 10 minutes later.
The IF line exits the process. When I ECHO the whole batch file, it looks like dt is taking its value from the contents of the file, rather than from the attributes. How do I get the modified date of the file, or cast a string to a date?
REM @echo off
REM set variable to flag file mod date in sys format
for /f "tokens=1,2" %%i in (C:\Admin\flag.txt) do (
set dt=%%i %%j
REM echo %dt%
REM compare flag mod date to sys date
if %dt% equ %date% GOTO indexer
echo Not Equal
REM dates not same so wait 10 minutes and try again
ping -n 601 localhost > nul
REM dates same so close Indexer
REM wait for fileserver to come back up
ping -n 11 localhost > nul
REM start Indexer again