VBScript - Displaying results of shell command in message-box using readline method within a function -


the script below displays last line of executed cmd. can't figure out how capture , display stdout stream.

option explicit dim wshell, result, box  set wshell = wscript.createobject("wscript.shell")  box = msgbox("current arp entries:" &vbcrlf& execstdout("cmd /c arp -a"))  function execstdout(cmd)     set result = wshell.exec(cmd)     while result.stdout.atendofstream <> true         execstdout = result.stdout.readline     loop end function 

can please point me in right direction?

corrected code

option explicit dim wshell, result, box  set wshell = wscript.createobject("wscript.shell")  box = msgbox("current arp entries:" & execstdout("cmd /c arp -a"))  function execstdout(cmd)     set result = wshell.exec(cmd)     while result.stdout.atendofstream <> true         execstdout = execstdout &vbcrlf& result.stdout.readline     loop end function 

just edit line execstdout = result.stdout.readline execstdout = execstdout & vbcrlf & result.stdout.readline.

you replace next line. edit, concatenate lines in 1 string separated linebreaks.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -