Jump to content

Command Prompt capture for existing window


Recommended Posts

Hi all, I have seen all the examples provided in this forum for command line window contents capture but all of them include running the cmd within autoit.

 

How can you capture and search for a string within an existing command line window tho that runs seperately and externally from another software? how do i get the id of the cmd window to monitor? doesnt the id change everytime its run?

 

can i capture/monitor the console window using window title that never changes?

 

cheers

 

 

Link to comment
Share on other sites

ok, I am going to post this, solution below:

https://stackoverflow.com/questions/12615665/in-windows-how-get-all-process-and-their-child-process-information-in-command-pr

wmic process get Caption,ParentProcessId,ProcessId

Given a parent PID you can list the immediate children with something like:

wmic process where (ParentProcessId=2480) get Caption,ProcessId

 

TEST: ok, so I ran a cmd, then explorer from it and notepad. i ran each of the above wmic statements from a cmd window. the second statement will show you the children of the parent and you could capture that and do what you like. In my case, the PID of cmd.exe was 4050 and his children where shown with their PIDs, notpad and explorer and WMIC.exe

 

Edited by Earthshine

My resources are limited. You must ask the right questions

 

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