繁体   English   中英

如何从 python 运行 Windows powershell 脚本?

[英]How to run Windows powershell script from python?

我想运行 Powershell 中的图片中的脚本,但来自 python。 [1]: https://i.stack.imgur.com/K7XGI.png例如,我想要这样的代码:

def run(namefile):
    command that opens powershell
    command that type in the powershell .\spim.exe .\namefile.txt
    command that run the script

有人知道该怎么做吗?

如果您只想运行 exe 文件,您可以使用subprocess module

如果你真的想在 Powershell 终端中运行它,你可以使用-Command 选项运行 Powershell 二进制文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM