I might try putting the command i a batch file and having the batch set the errorlevel on it's way out. That command is running in a cmd prompt and the command might not return the value, using exit in a batch file has worked for me.
exit [/b] [<exitcode>]
ParameterDescription
/bExits the current batch script instead of exiting Cmd.exe. If executed from outside a batch script, exits Cmd.exe.
<exitcode>Specifies a numeric number. If /b is specified, the ERRORLEVEL environment variable is set to that number. If you are quitting the command interpreter, the process exit code is set to that number.
exit [/b] [<exitcode>]
ParameterDescription
/bExits the current batch script instead of exiting Cmd.exe. If executed from outside a batch script, exits Cmd.exe.
<exitcode>Specifies a numeric number. If /b is specified, the ERRORLEVEL environment variable is set to that number. If you are quitting the command interpreter, the process exit code is set to that number.
Statistics: Posted by ira — 13 Jan 2024, 07:07