Sign in to follow this  
Followers 0
viper1000

Exit Code 0 instead of 2 !

3 posts in this topic

#1 ·  Posted (edited)

OS: VISTA Enterprise SP2

AutoIt: 3.3.6.1

Test Script: (exit.exe)

MsgBox(0, "","Test",2)
Exit 2

Situation:

Using AutoIt generated EXE inside of a Batch routine always return the correct ReturnCode.

Starting AutoIt generated EXE from a another program may NOT return the expected ReturnCode !

Test:

If I execute my exit.exe in a DOS shell @echo %errorlevel% returns 0 instead of 2 :party:

If I execute cmd /c exit.exe in a DOS shell @echo %errorlevel% returns 2 :mellow:

If I execute start /w /c exit.exe in a DOS shell @echo %errorlevel% returns 2 :P

Questions:

  • Has anyone a explanation on this behaviour ?
  • Is there another possibility to receive the expected return Code without prefix cmd /c, start /w OR using a batch?
Edited by viper1000

Share this post


Link to post
Share on other sites



If you don't wait for a program to finish, how do you want to get the exit code?

In your first example your DOS Shell will not wait til the exit.exe exit.

You may compile as CUI if you don't want to use start /w or /c

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

If you don't wait for a program to finish, how do you want to get the exit code?

In your first example your DOS Shell will not wait til the exit.exe exit.

You may compile as CUI if you don't want to use start /w or /c

Thanks a lot for your hint. Using CUI is what I needed !! :mellow:

Edited by viper1000

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  
Followers 0