Sign in to follow this  
Followers 0
Baraoic

RunDOS Error

3 posts in this topic

So while testing something I noticed that either my computer is retarded or somethings wrong because when I run

#include <Process.au3>
Local $a, $b
$a = _RunDOS("ping 1.1.1.1")
MsgBox(0,'',"Exit code for 1.1.1.1:" & $a & " Error code:" & @error)
$b = _RunDOS("ping 127.0.0.1")
MsgBox(0,'',"Exit code for 127.0.0.1:" & $b & " Error code:" & @error)

it gives exit code 1 and error code 0 for 1.1.1.1 and exit code 0 and error code 0 for 127.0.0.1. According to the help file exit code 1 is success with 0 error code and exit code 0 is error but its suppose to have an error code. Also im running 3.3.0.0 with windows 7 64 bit.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

_RunDos() retuns the %ERRORLEVEL% in the retuncode. from the hlepfile:

Return Value

Success: Returns the exit code of the command

Failure: Returns 0 and sets @error to non-zero.

Try this script to demonstrate:

$fh = FileOpen("test.bat",2)
FileWriteLine($fh,"ping 1.1.1.1")
FileWriteLine($fh,"ECHO Errorlevel: %ERRORLEVEL%")
FileWriteLine($fh,"ping 127.0.0.1")
FileWriteLine($fh,"ECHO Errorlevel: %ERRORLEVEL%")
FileClose($fh)
Run(@comspec & " /k test.bat")

Jos :)

Edited by Jos

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

Share this post


Link to post
Share on other sites

Oh thank you :)

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