MrChris Posted September 1, 2006 Posted September 1, 2006 (edited) What is the best way I could get the Output of an Errorlevel/returncode if the return code is anything other than a 0 and send the output of what is displays to a msgbox? I have a few commands I am running from a command line via RunWait like below. If there is an error when processing the bwlow commands I was hoping I could see the actual error without setting @SW_SHOW. Rather than just getting the Return Code I was hoping to get an actual Error message that the RunWait line may give sent to a MSGBOX. This is what I have been able to come up with. #NoTrayIcon Opt("RunErrorsFatal", 0) ; Adds User to the local copmuters Account NT database RunWait('net user /add Support /comment:"Built-in account so IT can administer the computer" /fullname:"Local IT Administrator" /times:all /expires:never /active:yes /workstations:*',"",@SW_HIDE) if @error <> 0 Then MsgBox(1024,"Error Creating Account","There was an Error creating the new User Account." & @CRLF & "The error code returned was : " & @error ) EndIf ; Adds user to Local Administrators Account RunWait("net localgroup administrators /add Support","",@SW_HIDE) if @error <> 0 Then MsgBox(1024,"Error Setting Permissions","There was an Error setting the user permissions." & @CRLF & "The error code returned was : " & @error ) EndIf Exit Thanks for any help, MrChris Edited September 1, 2006 by MrChris
MrChris Posted September 1, 2006 Author Posted September 1, 2006 Sorry I used the wrong Subject for this I meant to have it say "Get Output of Error Message and send it to a MSGBOX" if that makes it any eiser? MrChris
MrChris Posted September 1, 2006 Author Posted September 1, 2006 Aparently that is what "StderrRead" and "StdoutRead" are for. Everytime I learn something new in AutoIT I end up diggin it that much more. MrChris
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now