runret returns the standard output only. So I thought of echoing %errorlevel% to stdout, but this doesn't work:
Code: Select all
::echo runret("%COMSPEC% /c reg QUERY HKCU\Environment /ve & echo %errorlevel%", "%WINDIR%\system32\");
::echo runret("%COMSPEC% /c reg QUERY HKCU\Environment /v NONEXISTENT_VALUE & echo %errorlevel%", "%WINDIR%\system32\");I know about exit-code based conditional running with && and ||, but this still doesn't give me the actual exitcode.
Code: Select all
::echo runret("%COMSPEC% /c reg QUERY HKCU\Environment /ve && echo success || echo fail", "%WINDIR%\system32\");
::echo runret("%COMSPEC% /c reg QUERY HKCU\Environment /v NONEXISTENT_VALUE && echo success || echo fail", "%WINDIR%\system32\");
XYplorer Beta Club