Jump to content
Sign in to follow this  

"Exit <anything>" always results in %ERRORLEVEL% 0

Recommended Posts

Using AutoIt

Either intyerpreted or compiled, I am gettittin 0 as en exit value from any script, regardless of the value given to Exit.

What's wrong?

Simple example, to return the amount of memory in GB as an integer.

$memstats = MemGetStats()

$mem = $memstats[1] / (1024*1024)

$GB = Round($mem, 0) ; should be 1 if memory > 500MB and < 1.5 GB


Exit $GB

Run on a 1 GB system, the MsgBox shows 1, but the value of %ERRORLEVEL% is 0.

Share this post

Link to post
Share on other sites

Ah, didn' "get" the start /wait necessity.

Alreadly figured out how to get text:

for /f %x in ('somescript.exe') do set VAR=%x

same idea,


(oh, thatsgreat, that's how to return a numeric value in errorlevel)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...