I am executing cmd commands using python subprocess module. Execution of this cmd commands (eg., running some batch file, .exe file) are opening new command prompt window. How to read output of newly open cmd window using python?
I am using following code to execute commands provided by user:
process = subprocess.Popen(command, cwd = working_directory, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
I am using process.communicate() method to read the output. However it is allowing me to read output of the existing command prompt window only. If user is providing command which triggers new command prompt window, then how to read output of that window?