Reputation: 51
Is there a way to hide the windows command prompt or prevent it from popping up every time I us a command with python? My program loops command prompt commands causing my screen to flash with prompts.
Upvotes: 0
Views: 1218
Reputation: 63707
Use subprocess.call or Popen with shell=True
as an argument. Here is an example with Popen
>>> import subprocess
>>> p = subprocess.Popen('pwd', shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
>>> output = p.stdout.read()
>>> print output
C:\Python27
Upvotes: 1