Jump to content

get cmd info


am632
 Share

Recommended Posts

Hi,

If I use the command...

FileWrite(@ScriptDir & "\example.bat", "commands" & ">log.txt")

& then I run the generated batch file, I get a log.txt file of the command which has run. However I want to get the info from a cmd box which hasnt been started by autoit. How can I do this?

I wan thinking something like..

If ProcessExists("example.exe")

Then 'Get log.txt from example.exe's cmd box'

but I dont know how to do the code for that bit. The example.exe runs in command prompt but isnt a .bat file

Can anyone help please?

Thanks

Link to comment
Share on other sites

Hello am632,

if you want to grab the outputs of example.exe you might want to have a look at StdoutRead() or StderrRead() in the helpfile.

Edited by hannes08
Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

Hi,

I have looked at those in the help file but im afraid I cant see how this would work for what i'm trying to do. From what I can read these commands work for a child process which is run through the autoit script. I want to capture the command output from the example.exe which hasnt been executed by the script.

If im incorrect and this can be achieved by the code you said could you possibly provide an example because I cant 'see' it.

Thanks for ur help

Link to comment
Share on other sites

  • 5 weeks later...

Hi,

I have looked at those in the help file but im afraid I cant see how this would work for what i'm trying to do. From what I can read these commands work for a child process which is run through the autoit script. I want to capture the command output from the example.exe which hasnt been executed by the script.

If im incorrect and this can be achieved by the code you said could you possibly provide an example because I cant 'see' it.

Thanks for ur help

I am not the guru, but searching for insights I noticed your question and wanna help, if you still interested.

If I get your point, your example.exe is running separately. If it was started in cmd shell, then "example.exe" should be a part of window title.

Else maybe you can identify it some other way around.

Anyway, you could try to get its PID, or PID of its CMD shell (using WinGetProcess and Opt (WinTitleMatchMode) and proceed with it to get Stdout/Stderr output.

Hope it helps.

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