【发布时间】:2018-09-03 12:35:12
【问题描述】:
我尝试了以下方法来打开命令提示符并运行示例命令。但它立即关闭:
import os
# as of now i am just passing cd /../, later will be changing to a different command
os.system("start /wait cmd /c {cd /../}")
我也尝试过这种方式,但这会打开两个命令 shell:
import os
os.system("start /B start cmd.exe @cmd /k cd /d D:")
是否可以只打开一个命令提示符并运行命令?
【问题讨论】: