I'm trying to get return value from console application in batch file. Console application keep returns 0 value even when the rtnValue is 1 in console application
Console Application Code
Public Function Main() As Integer
Dim rtnValue as Int16 = 0
if Not Process Then rtnValue = 1
Return rtnValue
End Function
Batch File
@ECHO OFF
start /d "%~dp0" ConsoleApp.exe
if "%ERRORLEVEL%" == "0" goto success
:success
echo Success with error code: %ERRORLEVEL%
PAUSE
goto end
:error
echo Failed with error code: %ERRORLEVEL%
PAUSE
:end