DigDeep

Display Commandline results

4 posts in this topic

Hi,

Is there a way, I can display the below command in msgbox?

RunWait(@ComSpec & " /c " & "wmic bios get serialnumber", "", @SW_HIDE)

 

Share this post


Link to post
Share on other sites



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)

 

1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Great... thanks to both. I modified as I needed. :thumbsup:

Edited by DigDeep

Share this post


Link to post
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