【发布时间】:2018-07-17 09:10:12
【问题描述】:
参考Change directory and execute file in one command
我编写了一个简单的 python shell 脚本,它打开终端 cmd.exe,然后应该更改目录并在 this 目录中运行第二个命令。
os.system("start /B start cmd.exe @cmd /k cd [the directory I want to go] to && [the command I want to execute in the changed directory]")
程序在第一个更改目录命令完成之前运行第二个命令,因此第二个命令失败。需要帮助等到第一个命令完成,并且切换目录成功,然后在更改的目录中,我需要执行第二个命令。
谢谢,任何帮助将不胜感激
【问题讨论】:
标签: python-2.7 cmd sequential cd