Jump to content

STDIn/Out stuff!


Recommended Posts

Is there a way to clear the data from the reads of a CMD window? I'm opening a command prompt, remoting into a machine with ODBC's to an MDB and running OSQL to pull info. Once I've run the OSQL command I want to read it's output only into a variable, and then send another, read it into a variable, etc, etc... it's very basic so far, using the AutoIT example as a base.

Local $foo = RunAs("user","domain","pass",0,@ComSpec & " /k c:\downloads\pstools\beyondexecv2 \\seclpcadsm01 cmd","c:\downloads\pstools",@SW_SHOW,$STDIN_CHILD + $STDOUT_CHILD)

StdinWrite($foo, "osql -S seclpcansdb01 -U user -P pass -e -b -Q" & '"select domain_uuid from ca_discovered_hardware where host_name=' & "'lxpls981mis010'" & @CRLF)
Sleep(5000)

StdinWrite($foo)

Local $data
While True
    $data &= StdoutRead($foo)
    If @error Then ExitLoop
    Sleep(25)
WEnd
MsgBox(0, "Debug", $data)
Edited by GregThompson
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...