Python 到 Windows 命令提示符界面

Aka*_*ash 1 windows-7 python

有没有办法可以将命令发送到 Windows 命令提示符 Python?

我想要做的是在桌面上制作一个 Python 应用程序,它通过套接字从另一台计算机/移动应用程序接收命令。

然后将这些命令传递到 Windows 命令提示符以供执行。

使用 Windows 7。

Nif*_*fle 5

使用子进程模块

from subprocess import call

call(['cmd', 'arg1', 'arg2'], stdin='...', stdout='...')
Run Code Online (Sandbox Code Playgroud)

例如:

call(['dir', '/W'])
Run Code Online (Sandbox Code Playgroud)

在此处阅读更多信息子流程管理