how to include success or failure return codes in IF EXIST statemnt in batch script

  • Thread starter Thread starter raj.atla
  • Start date Start date
R

raj.atla

Helloo All
Any ones help would be appriciated,
in the below code how should i include the return code for failure
and success so that the command if %errorlevel%
could identify
--------------
if exist "c:\test\file.ext" echo failure
move/y "C:\test\file.ext" "C:\quality\"
if not exist "c:\test\file.ext" echo success
if %errorlevel% NEQ 0 GOTO ERROR
:ERROR
 
move /y "C:\test\file.ext" "C:\quality\"
if %errorlevel% == 1 echo success
if %errorlevel% == 0 echo failure
 
Back
Top