How to get the %ERRORLEVEL%
Posted: 09 Aug 2021 11:57
Hi everybody,
I would like to use an external command which is called Wprompt (author: Horst Schaeffer)
https://www.horstmuc.de/w32dial.htm#wprompt
This command displays a message box with buttons (Ok, Cancel, ...)
The Exit Code (Errorlevel) is 1..3 according to the selected button number.
On timeout the default button number is returned.
I manage to get this command to work in a cmd window, I get 1 or 2. On the other hand, when I use it in my script, the %ERRORLEVEL% variable is always equal to 0, impossible to get the right value.
Could a charitable soul come to my aid?
Thanks in advance.
I would like to use an external command which is called Wprompt (author: Horst Schaeffer)
https://www.horstmuc.de/w32dial.htm#wprompt
This command displays a message box with buttons (Ok, Cancel, ...)
The Exit Code (Errorlevel) is 1..3 according to the selected button number.
On timeout the default button number is returned.
I manage to get this command to work in a cmd window, I get 1 or 2. On the other hand, when I use it in my script, the %ERRORLEVEL% variable is always equal to 0, impossible to get the right value.
Code: Select all
if %essais% LSS 2 (set /a essais+=1) else (
Wbusy "Etablissement du tunnel avant connexion" /stop /sound
Wprompt "Notification d'échec de la connexion SSH" "La connexion au serveur relais a échoué (délai maxi : 30 sec)" OkCancel 1:15 x
echo %ERRORLEVEL%
pause
goto :stop
)
Thanks in advance.