Author Topic: exit qb64 and set %ERRORLEVEL% to be used in a bat/cmd  (Read 2818 times)

0 Members and 1 Guest are viewing this topic.

Offline doppler

  • Forum Regular
  • Posts: 241
    • View Profile
exit qb64 and set %ERRORLEVEL% to be used in a bat/cmd
« 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)

FellippeHeitor

  • Guest
Re: exit qb64 and set %ERRORLEVEL% to be used in a bat/cmd
« Reply #1 on: August 22, 2020, 09:59:39 am »
Use SYSTEM to return an exit code:

Code: QB64: [Select]

Offline doppler

  • Forum Regular
  • Posts: 241
    • View Profile
Re: exit qb64 and set %ERRORLEVEL% to be used in a bat/cmd
« Reply #2 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.