Jump to content

Dos system command 'set' results

Recommended Posts

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?



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

Link to comment
Share on other sites

Try somethin like this:

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

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



Link to comment
Share on other sites

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...