J
jeeji
Hi
I have a .Net 3.5 windows console application (TextTool.exe) that
makes a call to Environment.Exit(1), which AKAIK sets the errorlevel
to 1. But this does not work as expected.
When I call it from a command line script and check for errorlevel 0,
I get True.
So the following script:
TextTool.exe
if errorlevel 0 (
echo Exited with 0
)
always echoes "Exited with 0", eventhough it makes a call to
Environment.Exit(1).
If I in between do an echo %errorlevel% I get 1. So the following
script
TextTool.exe
echo Errorlevel is %errorlevel%
if errorlevel 0 (
echo Exited with 0
)
always echoes:
Errorlevel is 1
Exited with 0
If I instead perform the check:
TextTool.exe
if %errorlevel%==0 (
echo Exited with 0
)
it works fine.
HOW COME???
Thanks
Jeeji
I have a .Net 3.5 windows console application (TextTool.exe) that
makes a call to Environment.Exit(1), which AKAIK sets the errorlevel
to 1. But this does not work as expected.
When I call it from a command line script and check for errorlevel 0,
I get True.
So the following script:
TextTool.exe
if errorlevel 0 (
echo Exited with 0
)
always echoes "Exited with 0", eventhough it makes a call to
Environment.Exit(1).
If I in between do an echo %errorlevel% I get 1. So the following
script
TextTool.exe
echo Errorlevel is %errorlevel%
if errorlevel 0 (
echo Exited with 0
)
always echoes:
Errorlevel is 1
Exited with 0
If I instead perform the check:
TextTool.exe
if %errorlevel%==0 (
echo Exited with 0
)
it works fine.
HOW COME???
Thanks
Jeeji