Jump to content

Retrieve Errorlevel from CMD Line (eg.,Ping)


ken82m
 Share

Recommended Posts

It looks like and errorlevel of 0 means ping was successful. Well this thing always tells me it was succesful.

I've tried:

RunWait("Ping Exchange", @WindowsDir, @SW_HIDE)

$EC = EnvGet("ErrorLevel")

If $EC = 0 Then

MSGBOX(4096,"Exchange", "Exchange was pinged succesfully.")

Else

MSGBOX(4096,"Exchange", "Exchange was NOT pinged succesfully.")

EndIf

Exit

I guess I'm getting 0 all the time because the "DOS" window is ending normally. Does anyone have any experience with this?

Thanks,

Kenny

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Link to comment
Share on other sites

It looks like and errorlevel of 0 means ping was successful. Well this thing always tells me it was succesful.

I've tried:

RunWait("Ping Exchange", @WindowsDir, @SW_HIDE)

$EC = EnvGet("ErrorLevel")

If $EC = 0 Then

MSGBOX(4096,"Exchange", "Exchange was pinged succesfully.")

Else

MSGBOX(4096,"Exchange", "Exchange was NOT pinged succesfully.")

EndIf

Exit

I guess I'm getting 0 all the time because the "DOS" window is ending normally. Does anyone have any experience with this?

Thanks,

Kenny

Pseudo code:

$res = RunWait()
If $res = "something" Then 
    DoSomething()
Else
    DoNothing()
EndIf

RunWait should return the return value of whatever program you execute (Note: Because of the way Run works, it does not do this, too, only RunWait).

Link to comment
Share on other sites

ahhhh perfect thank you very much :whistle:

 "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

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