asiawatcher Posted June 27, 2018 Share Posted June 27, 2018 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 More sharing options...
Earthshine Posted June 27, 2018 Share Posted June 27, 2018 (edited) 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 June 27, 2018 by Earthshine asiawatcher and Gianni 2 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
asiawatcher Posted June 28, 2018 Author Share Posted June 28, 2018 cheers! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now