Jump to content

Display Commandline results


DigDeep
 Share

Recommended Posts

  • Moderators

Like this, maybe?

#include <Constants.au3>

$net = Run(@ComSpec & " /c wmic bios get serialnumber", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
$final = ""

While 1
    $line = StdoutRead($net)
    If @error Then ExitLoop
    If $line <> "" Then $final &= $line
Wend

    MsgBox(0, "STDOUT read:", $final)

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

just for fun, here is also a shrinked version

#include <Constants.au3>

Local $net = Run("wmic bios get serialnumber", "", "", $STDERR_MERGED), $final = ""

Do
    $final &= StdoutRead($net) ; stores the output of the wmic command while is generated
Until @error ; when wmic finish, it closes itself, so StdoutRead arises an @error

MsgBox(0, "STDOUT read:", $final)

 

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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