How to run a DOS batch file in background using Python?
I have a test.bat file in say C:\
Now, I want to run this bat file using python in the background and then I want to return to the python command line.
I run the batch file using
(Running test.bat. Can't use python in the same window)
(New commandline window created in the background where test.bat runs in parallel.)
This seems to work for me:
import subprocess p = subprocess.Popen(r'start cmd /c C:\test.bat', shell=True) p.wait() print 'done'