0

I want to write a script that opens the cmd shell (windows) issues a command then retrieves the output and sends another command. So far I'm able to send a command and retrieve the output but the session closes and I don't want that. I want to keep sending commands to the same cmd window (session).

from subprocess import check_output
command = 'dir C:'
out_put = check_output(command, shell=True).decode()
print(out_put)
magicsword
  • 1,179
  • 3
  • 16
  • 26

0 Answers0