When calling a
find /V /I
only with /V(!) the ERRORLEVEL is always 0 it appears to me. (Using Win7 x64)
If, for example, I run the following batch file
@echo off
SETLOCAL enabledelayedexpansion
find /V /I "camstart" testtest.txt
echo Errorlevel is !ERRORLEVEL!
on this testtest.txt file
intrinsicParamStatus(2338763)
calibrationFormatID(260)
calibrationFormatID(260)
leftCamStartX(88)
leftCamStartY(170)
rightCamStartX(88)
the output is:
---------- TESTTEST.TXT
intrinsicParamStatus(2338763)
calibrationFormatID(260)
calibrationFormatID(260)
Errorlevel is 0
and if I run
@echo off
SETLOCAL enabledelayedexpansion
find /V /I "camstarRt" testtest.txt
echo Errorlevel is !ERRORLEVEL!
the output is
intrinsicParamStatus(2338763)
calibrationFormatID(260)
calibrationFormatID(260)
leftCamStartX(88)
leftCamStartY(170)
rightCamStartX(88)
Errorlevel is 0
Evidently the output matches the task to find the string "camStarRt", which is not there, so it outputs all lines. But why doesn't that change the errorlevel?
When do exactly the same with
@echo off
SETLOCAL enabledelayedexpansion
find /I "camstarrt" testtest.txt
echo Errorlevel is !ERRORLEVEL!
The errorlevel becomes 1, as expected.
Is this a bug in find? How can I come across this?
My goal is to execute a task if a certain string in the output of a python-script is found. But if it's not, all lines of it shall be displayed as usual to see thework of the script.
python.exe C:\pycan-bin\xxx\yyy.py -m read -p lala16 -o %outfile% parameters.json | find /V /I "Response timeout"