Sign in to follow this  
Followers 0
lte5000

AutoIt3 /c "Exit"

6 posts in this topic

#1 ·  Posted (edited)

I run this from a CMD window on WinXP SP2:

"%ProgramFiles%\autoit3\autoit3.exe" /c "Exit 1"

Then I run this:

echo %errorlevel%

This echos a 0, shouldn't it echo 1?

Or am I doing something wrong?

Kendall

Edit: Typo.

Edited by lte5000

Share this post


Link to post
Share on other sites



Put the following in a batch file:

REM someFile.bat
@echo off
"%ProgramFiles%\autoit3\autoit3.exe" /c "Exit 1"
echo Error code is %errorlevel%
pause

AutoIt appears to work fine. I think it's a feature of the command prompt that %errorlevel% gets reset when a a non-batch command finished executing.... or something like that.


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

*Off-topic* Cyberslug, do you know anything about the Virginia Kentucky resolution in 1789 I think? I'm doing a report on it, since you're from Kentucky you might know! PM me if you know anything.

Share this post


Link to post
Share on other sites

I run this from a CMD window on WinXP SP2:

"%ProgramFiles%\autoit3\autoit3.exe" /c "Exit 1"

Then I run this:

echo %errorlevel%

This echos a 0, shouldn't  it echo 1?

Or am I doing something wrong?

Kendall

Edit: Typo.

<{POST_SNAPBACK}>

Works!

Thanks CS.

Share this post


Link to post
Share on other sites

Please add this at the top of the FAQ ;) What a crazy behaviour!

Simeon

Share this post


Link to post
Share on other sites

AutoIt appears to work fine. I think it's a feature of the command prompt that %errorlevel% gets reset when a a non-batch command finished executing.... or something like that.

Correct me if I'm wrong, but Autoit3.exe is a GUI program, therefore the error code isn't passed back to the command interpreter unless you explicitly wait for it.

Try:

start /wait "" "%programfiles%\autoit3\autoit3.exe" /c "Exit 12345"

It should work outside of a batch file.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

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