Python を使用してバックグラウンドで DOS バッチ ファイルを実行する方法は?
たとえば C:\ に test.bat ファイルがあります。
バックグラウンドで Python を使用してこのバット ファイルを実行し、Python コマンド ラインに戻りたいと考えています。
subprocess.call('path\to\test.bat')
Pythonコマンドラインから使用してバッチファイルを実行します。Python コマンド ラインと同じウィンドウでバッチ ファイルを実行します。
それでもクリアできない場合/TL.DR-
何が起こっている:
>>>subprocess.call('C:\test.bat')
(Running test.bat. Can't use python in the same window)
私が欲しいもの:
>>>subprocess.call('C:\test.bat')
(New commandline window created in the background where test.bat runs in parallel.)
>>>