Jump to content
Sign in to follow this  
hmsSurprise

Dos system command 'set' results

Recommended Posts

hmsSurprise

From a dos cmd window typing set <CR> lists a set of system variables. Run returns a pid and ShellExec returns a 1 or 0. Is there a way to capture the output of this command?

Thanx,

jh

(Note to PsaltyDS - I checked the help file and forums but might have missed it. :shocked: )

Share this post


Link to post
Share on other sites
tannerli

Try somethin like this:

$pid=Run(@ComSpec & " /c " & 'set', "", @SW_HIDE)
StdoutRead($pid)

didn't test that but with these commands you're able to do it. The are described in the Helpfile

Share this post


Link to post
Share on other sites
hmsSurprise

Try somethin like this:

$pid=Run(@ComSpec & " /c " & 'set', "", @SW_HIDE)
StdoutRead($pid)

didn't test that but with these commands you're able to do it. The are described in the Helpfile

Ouch, I knew it would show up there. Tried this out but it didn't work, just flashed. But the good news is that while looking up @comspec I found other macros that had the data I was after. So I die happy...

Thanks,

jh

Share this post


Link to post
Share on other sites
PsaltyDS

So the answer came to you while reading the help file... imagine that! :shocked:

P.S. The STDOUT read is a good technique to learn anyway. The given example just needs some debug and a loop to catch all the data:

$ShellVars = ""
$pid = Run(@ComSpec & " /c set", @TempDir, @SW_HIDE, 2) ; 2 = $STDOUT_CHILD
While 1
    $ShellVars &= StdoutRead($pid)
    If @error Then ExitLoop
WEnd

MsgBox(64, "Shell Variables", $ShellVars)

:(

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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
Sign in to follow this  

×