In Windows 2008, I'm trying to write a batch file that runs a Windows utility.
In one case, the utility returns silently, and the batch file should return a success condition.
In the other case, the utility returns one or more lines of status info, and the batch file should return an error condition.
In Batch scripts, I'm not familiar with assigning the output of a utility to a variable, then testing it. In shell, I might use "wc -l".
Maybe the utility returns a return code in addition to some text output, and I can check the return code. Happy to test that, but don't know how to go about it.
Any thoughts, or pointers to batch documentation are appreciated.
Thanks...Lyle
run a utility, then make a decision on the result returned
Moderator: DosItHelp
Re: run a utility, then make a decision on the result return
Code: Select all
@echo off
start "nexist" "nexist.XEX"
if errorlevel 0 (
echo.succes
) else (
echo.failed
)
pause
exit /b