Python - subprocess for Windows
This page is going to document my study journey for subprocess on Windows environment
Getting Start
import subprocess
subprocess.call("dir", shell=True) #Run under Windows How to use "|" command
import subprocess
command1 = subprocess.Popen(['dir'],
shell=True,
stdout=subprocess.PIPE,
)
command2 = subprocess.Popen(['findstr', 'py'],
stdin=command1.stdout,
shell=True,
stdout=subprocess.PIPE,
)
end_of_pipe = command2.stdout
for line in end_of_pipe:
print('\t', line.strip())Interactive way to print the output
Windows Constants (Flags)
Last updated