. cmd, yourblahprogram<ENTER> do echo %ERRORLEVEL%
0 . non zero .
DIR,
C:\Users\user\aa\a>dir
Volume in drive C has no label.
Volume Serial Number is B411-D580
Directory of C:\Users\user\aa\a
03/04/2017 11:11 PM <DIR> .
03/04/2017 11:11 PM <DIR> ..
0 File(s) 0 bytes
2 Dir(s) 15,943,544,832 bytes free
C:\Users\user\aa\a>echo %ERRORLEVEL%
0
C:\Users\user\aa\a>dir sdsklfjdlkdfjs
Volume in drive C has no label.
Volume Serial Number is B411-D580
Directory of C:\Users\user\aa\a
File Not Found
C:\Users\user\aa\a>echo %ERRORLEVEL%
1
C:\Users\user\aa\a>
C:\Users\user>if NOT ERRORLEVEL 0 echo asdf
, , . 'cos NOT ERRORLEVEL 0 not >= 0. If/? () Windows
, errorlevel 0. IF %ERRORLEVEL% NEQ 0 echo asdf
, throw new System.Exception();
C:\Users\user>a.exe
asdf
Unhandled Exception: System.Exception: Exception of type 'System.Exception' was thrown.
at CustomMath.Main()
C:\Users\user>echo %ERRORLEVEL%
-532462766
C:\Users\harvey>
, .
if windows cmd batch script, && ||
, , WriteLine ( "asdf" ); .
, , && , errorlevel 0, , . , , echo qwerty, qwerty.
C:\Users\user>a.exe && echo qwerty
asdf
Unhandled Exception: System.Exception: Exception of type 'System.Exception' was thrown.
at CustomMath.Main()
. || OR, , , , , , , . , , qwerty.
C:\Users\user>a.exe || echo qwerty
asdf
Unhandled Exception: System.Exception: Exception of type 'System.Exception' was thrown.
at CustomMath.Main()
qwerty
C:\Users\user>
, .
, , linux.