使用 python 模拟用户 cmd 命令

simulate a user cmd command using python

我正在尝试在我的程序 运行ing

时创建 exe 文件

我正在尝试通过 python 中的代码编写 .py 文件并使用包 py2exe 来创建 exe。

我的问题是我希望程序会自动进行(用户不必打开 cmd 和 运行 安装文件)

手动我知道如何使用 py2exe

如果我可以从代码发送 cmd 命令,那就完美了!

有什么建议吗?

试试这个:http://www.pyinstaller.org/

应该完全适合您的用例。

您可以拥有此处所述的 .bat 文件: How can I run a program from a batch file without leaving the console open after the program start?

将您想要的命令放入 bat 文件中,然后 运行 使用 python 将其 python 如下所述: Executing a subprocess fails