I want to open cmd.exe using python, then send several commands sequentially to the cmd.exe and see the output in the same cmd.exe window. How can I do this? Using the following code doesn't show the output in the cmd.exe window.
proc = subprocess.Popen("cmd", creationflags=subprocess.CREATE_NEW_CONSOLE)
proc.communicate("dir\n")