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
  • 112,593
  • 23
  • 157
  • 280

1 Answers1

1

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

subprocess.call('insert command here', shell=True)
Ofir Gottesman
  • 334
  • 4
  • 9
  • 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