I use a scheduling system on a Windows 2003 server that requires batch files to run different jobs. I have one job that checks if a file exists, compares that the file is not empty, then does something based on the results. Each time I run this, the error level returned is 0, but the files are different. I'm expecting to see a 1 returned.
I've verified the location of the files, and one file has content and the other is empty. I've setup prompts, and they they all say %ERRORLEVEL% is 0. I even moved the files to be in the same directory at the batch job, but they still show 0.
The code:
echo %ERRORLEVEL%
IF EXIST data.DON (
echo before %ERRORLEVEL%
FC data.DON ZERO.SEQ
echo after %ERRORLEVEL%
IF %ERRORLEVEL% EQU 1 GOTO :PROCESS
)
The output:
16:37:08.12 Thu 03/29/2012
>IF EXIST data.DON (
echo before 0
FC data.DON ZERO.SEQ
echo after 0
IF 0 EQU 1 GOTO :PROCESS
)
before 0
Comparing files data.DON and ZERO.SEQ
***** data.DON
Name|Date|Location
***** ZERO.SEQ
*****
after 0
I have this exact code in other jobs on the same server pointing at different data files, and it works. Any ideas of what I can try?