Jump to content

CMD issue


Recommended Posts

I am planning to embed cmd to my GUI. This is the function am using.

Func _getDOSOutput($command)
Local $text = '', $Pid = Run(@ComSpec & ' /c ' & $command, '', @SW_HIDE, 2 + 4)
While 1

  $text &= StdoutRead($Pid)

  If @error Then ExitLoop
WEnd
GUICtrlSetData($Output,$text)
EndFunc;==>_getDOSOutput

To the variable "$command" am passing the commands. The problem is that if we ping to a particular ip address it's not pinging. But if we just type ping it's replying.

Can anyone points me in the right direction ??

Link to comment
Share on other sites

  • Developers

Where do I start..... 

  • Posting in the wrong forum.
  • Bumping within 24 minutes ( seriously??)
  • Multiple topic creation on the same subject.

so: start with reading the the forum rules before continuing posting in these forums and .. be patient!

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

Your function works for me. The slightly modified version below displays the result of the ping command in the message box.
Perhaps the problem is with the line GUICtrlSetData($Output,$text) but as I don;t have your GUI code I was unable to test that.

_getDOSOutput("Ping 204.79.197.200")
_getDOSOutput("Ping www.bing.com")
_getDOSOutput("Ping 192.168.1.72"); <===== Change this for something on your own network

Func _getDOSOutput($command)
Local $text = '', $Pid = Run(@ComSpec & ' /c ' & $command, '', @SW_HIDE, 2 + 4)
While 1

  $text &= StdoutRead($Pid)

  If @error Then ExitLoop
WEnd
;GUICtrlSetData($Output,$text)
MsgBox(0,"Ping Test",$text) ;<==== Just for testing
EndFunc;==>_getDOSOutput

 

Edited by Bowmore

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

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