使用python 3

时间:2018-10-03 07:14:18

标签: python windows

我想启动一个批处理文件,并使用python将命令发送到该命令行。

我尝试了os模块,但只打开了Windows命令行。

例如:

import os
os.system('cmd')

// and now in pseudo-code:
cd to directory
run batch file
send commands to that command line

1 个答案:

答案 0 :(得分:0)

像这样使用subprocess模块:

import subprocess

subprocess.Popen("Your command here", shell=True)