0

I'm able to run commands through CMD with Python with subprocess.call('insert command here') but it opens the CMD window then closes right away. Is there a way to not open it at all?

martineau
  • 119,623
  • 25
  • 170
  • 301

1 Answers1

1

You can set shell=True when calling subprocess.call:

subprocess.call('insert command here', shell=True)
Ofir Gottesman
  • 374
  • 4
  • 11
  • 1
    Do you happen to know why setting `shell=True` suppresses the `cmd` window? It seems to me like it would do the opposite of that… – martineau Jun 09 '21 at 00:15