Sign in to follow this  
Followers 0
GregThompson

STDIn/Out stuff!

5 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



1) Locate _RunReadStd()

2) Download it.

3) Use it. All of your troubles will go away :)


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

thx , plato -- I need to bookmark that link , I'm rarely in the forums these days.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

Thanks fellas, I really appreciate it!

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