Python - subprocess for Windows
This page is going to document my study journey for subprocess on Windows environment
Getting Start
How to use "|" command
Below showing the example for running command "dir | findstr py", the trick here is using stdin and stdout params to chain them up.
Interactive way to print the output
The above example relies on process completion as a event of triggering the print output. However, how to print the stdout in more interactive way?
Windows Constants (Flags)
It is quite important to explore the topic of Windows Constants (flags) from using subprocess in Windows environment. IMO, subprocess is more POSIX friendly, there are functions are only supporting on Unix environment. If you want to achieve some similar features on Windows, you may need to read through what Flags available for you.
Here is the example of how to apply flags into your program using creationflags attribute on Popen()
Last updated
Was this helpful?