1

Basically what I'm looking to do is to have python code that I can run from cmd that opens a new cmd window then types commands into it. I have been able to open and run commands but the commands always run in the first cmd window. I think I might need to switch the cursor or something like that, but I don't know how. Here is my current code. import subprocess

subprocess.call('start', shell=True)

import time time.sleep(5)

cmd=['', ''] ### In the second '' you can type in cmd. for each in cmd:

process=subprocess.Popen(each,stdout=subprocess.PIPE,shell=True)

output=process.communicate()[0]

print(output.decode('utf-8'))

- Thanks

EDIT :

NVM Its in the similar one

Cl Garrett
  • 11
  • 6
  • 1
    What code are you using to run commands in the first cmd window? – Kevin Sep 13 '18 at 12:59
  • 1
    Possible duplicate of [Execute terminal command from python in new terminal window?](https://stackoverflow.com/questions/19308415/execute-terminal-command-from-python-in-new-terminal-window) – Telmo Trooper Sep 13 '18 at 13:01
  • Here is the Code: – Cl Garrett Sep 13 '18 at 13:31
  • import subprocess cmd=[' ', ' '] ### In the second ' ' you can type in cmd. for each in cmd: process=subprocess.Popen(each,stdout=subprocess.PIPE,shell=True) output=process.communicate()[0] print(output.decode('utf-8')) – Cl Garrett Sep 13 '18 at 13:31
  • Please update your original question instead of writing code in comments. It is very hard to read them there. – Sam Sep 13 '18 at 16:43

0 Answers0