|
Answer» Code: [Select]if "%filedate%" == "%cdate%" goto run if not "%filedate%" == "%cdate%" goto skip Remove spaces in IF tests. They should not be there. You are comparing "%filedate%"[space] with [space]"%cdate%" which will never be true. It must be me but my program is STILL not running as I would like it to run. If the filedate is equal to the cdate then it should goto skip unfortunately whether the dates in either files are equal or not it still goes to run. Below is the corrected code what is wrong with it??
Setlocal enabledelayedexpansion For /f "delims=" %%a in ('date /t') do set cdate=%%a Set /p filedate=<%LOCDIR%\date.txt ECHO %cdate%>%LOCDIR%\file.txt
if "%filedate%"=="%cdate%" goto skip if not "%filedate%"=="%cdate%" goto run
:run echo %PGRM% is updating to the LATEST version. echo Please don't close window, the database will open once it has been updated. copy %SRVDIR%\%PGRM% %LOCDIR%\%PGRM% DEL %LOCDIR%\date.txt echo %cdate% >> %LOCDIR%\date.txt START /MAX %MSACC% %LOCDIR%\%PGRM% goto end
:skip echo Starting %PGRM% START /MAX %MSACC% %LOCDIR%\%PGRM% goto end :endQuote from: LilG on October 14, 2009, 07:51:04 AM Code: [Select]Setlocal enabledelayedexpansion For /f "delims=" %%a in ('date /t') do set cdate=%%a Set /p filedate=<%LOCDIR%\date.txt Echo %cdate%>%LOCDIR%\file.txt
if "%filedate%"=="%cdate%" goto skip if not "%filedate%"=="%cdate%" goto run <--------remove this line; it doesn't do anything.
:run echo %PGRM% is updating to the latest version. echo Please don't close window, the database will open once it has been updated. copy %SRVDIR%\%PGRM% %LOCDIR%\%PGRM% del %LOCDIR%\date.txt echo %cdate% >> %LOCDIR%\date.txt START /MAX %MSACC% %LOCDIR%\%PGRM% goto end
:skip echo Starting %PGRM% START /MAX %MSACC% %LOCDIR%\%PGRM% goto end :end
|