Jump to content
Sign in to follow this  
mpchong

on error exit

Recommended Posts

mpchong

Hello all,

I am writing a script to change all of the local admin passwords on all our workstations. It's just a quick 3 liner:

RunAsSet("admin", @LogonDomain, "password")

RunWait(@ComSpec & " /c " & 'net users localAdmin changed ', "",@SW_MINIMIZE)

RunAsSet()

If the RunAsSet admin password is incorrect, I get a msgbox stating the error, and the admin name, password, etc...

My question is: If I get an error on my script, how can I make it just exit without the msgbox popping up?

Thank you,

Mike

Share this post


Link to post
Share on other sites
Jos

Add this at the top of your script:

Opt("RunErrorsFatal", 0)       ;1=fatal, 0=silent set @error

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
mpchong

Add this at the top of your script:

Opt("RunErrorsFatal", 0)      ;1=fatal, 0=silent set @error

<{POST_SNAPBACK}>

JdeB,

That is really cool, thanks for that!

Mike

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  

×