QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: doppler on August 22, 2020, 06:56:24 am

Title: exit qb64 and set %ERRORLEVEL% to be used in a bat/cmd
Post by: doppler on August 22, 2020, 06:56:24 am
It's possible for me to detect a critical error while running my QB64 program (finding corrupted data sets).  I would like to set %ERRORLEVEL% so the bat/cmd script I call my program can exit and not continue.  It's a real pain to detect the error and manually terminate the script command terminal before I exit the qb64 program.  Programs like WGET can set error levels so your calling script can do other things based on the code number.

I figure something like "_system=4" would exit with code 4 set in %ERRORLEVEL%.  Unfortunately %ERRORLEVEL% would need to be set to 0 on any exit path.  (system or end)
Title: Re: exit qb64 and set %ERRORLEVEL% to be used in a bat/cmd
Post by: FellippeHeitor on August 22, 2020, 09:59:39 am
Use SYSTEM to return an exit code:

Code: QB64: [Select]
Title: Re: exit qb64 and set %ERRORLEVEL% to be used in a bat/cmd
Post by: doppler on August 22, 2020, 04:06:32 pm
Nuisances, will get you every time.  You are most a where how much it is a hassle to have multiple languages swimming around in your head.  And I am not talking about the talking kind.

Thanks for the pointer.