Jump to content

RunDOS Error


Baraoic
 Share

Recommended Posts

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.

Link to comment
Share on other sites

  • Developers

_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

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.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...