Jump to content
Sign in to follow this  
superbosu

Exit code help

Recommended Posts

superbosu

Hi all!

I have a problem with my script...

How can I set the Exit code of my .exe?

Select

        Case $An = $Bn
            
            Exit (0)


        Case $An < $Bn
            

                     Exit (2)
endselect

I want that if $An = $Bn the .exe file return 0 and if $An < $Bn the .exe return 2

is there a way to do that?

tnx a lot

Edited by superbosu

Share this post


Link to post
Share on other sites
enaiman

That IS the way to set the exit code.

return code [optional] Integer that sets the script's return code. This code can be used by Windows or the DOS variable %ERRORLEVEL%. The default is 0. Scripts normally set an errorlevel of 0 if the script executed properly; error levels 1 and above typically indicate that the script did not execute properly.

Your script is missing the EndSelect statement; it won't run at all in the current form.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
superbosu

tnx for the reply.. i modified the code.

take a look upper.

mhhh...

is there a way to do the same thing like in DOS ?

DOS command: Exit 2

autoit command: ???

Share this post


Link to post
Share on other sites
enaiman

I don't know what is unclear for you?

The code you have is the working one. That is the way it is done.

What is not working for you??


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.