BigDaddyO Posted April 26, 2005 Posted April 26, 2005 I am trying to write a script that runs a DOS command from an input box. The user types into the input box what they want to run, then clicks OK. it will then run that command by doing the following opt("RunErrorsFatal", 0) $Command = InputBox("DOS-Command", "Input the command to run", "", " M", 240, 180) RunWait(@Comspec & " /k " & $Command, @TempDir) if @error = 1 then MsgBox(0, "Error", "Unable to run the command") The @error never returns anything but 0 no matter what I put in for the $Command. I am assuming the RunWait thinks it was successfull because the @Comspec launched but the actual command failed. Does anyone know of a way to return an error=1 if the command fails? Thanks, Mike
Developers Jos Posted April 26, 2005 Developers Posted April 26, 2005 I am trying to write a script that runs a DOS command from an input box.The user types into the input box what they want to run, then clicks OK. it will then run that command by doing the followingopt("RunErrorsFatal", 0) $Command = InputBox("DOS-Command", "Input the command to run", "", " M", 240, 180) RunWait(@Comspec & " /k " & $Command, @TempDir) if @error = 1 then MsgBox(0, "Error", "Unable to run the command")The @error never returns anything but 0 no matter what I put in for the $Command. I am assuming the RunWait thinks it was successfull because the @Comspec launched but the actual command failed.Does anyone know of a way to return an error=1 if the command fails?Thanks,Mike<{POST_SNAPBACK}>The Runwait command returns the exit code so use it like:$rc = Runwait() If $rc = 0 then ; do whatever endiforIf Runwait() then ; do whatever when rc not equal 0 endif SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
BigDaddyO Posted April 26, 2005 Author Posted April 26, 2005 Thanks, I guess this was another one of those times where I was over thinking it. Thanks JbeD
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