1
cmd
とと通信する方法はありますか?すべての出力をファイルに保存しますか?レスポンスを保存中にCMDと通信する
私はすべてのコマンドの後に、出力がサブプロセスの最後ではなく保存されることを意味します。
が、私はそれがこのような何かになりたい:
import subprocess
process = subprocess.Popen('C:\\Windows\\system32\\cmd.exe', stdout=subprocess.PIPE,
stdin=subprocess.PIPE)
while True:
with open("log.txt", "a+") as myfile:
myfile.write(process.stdout.readlines())
process.stdin(raw_input())
この質問をご覧くださいhttps://stackoverflow.com/questions/4417546/constantly-print-subprocess-output-while-proc ess-is-running – timlyo