python - 在 Python 或 F# 中运行带参数的批处理文件

标签 python windows web-services batch-file f#

我搜索了该站点,但没有找到与我要查找的内容完全匹配的内容。我创建了一个使用我创建的 Web 服务的独立应用程序。要运行我使用的客户端:

C:/scriptsdirecotry> "run-client.bat" param1 param2 param3 param4

我将如何使用 Python 或 F# 对此进行编码。看起来应该很简单,但是我在网上还没有看到任何与我正在寻找的东西完全匹配的东西。

最佳答案

Python 类似。

import os
os.system("run-client.bat param1 param2")

如果您需要异步行为或重定向标准流。

from subprocess import *
p = Popen(['run-client.bat', param1, param2], stdout=PIPE, stderr=PIPE)
output, errors = p.communicate()
p.wait() # wait for process to terminate

关于python - 在 Python 或 F# 中运行带参数的批处理文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2916758/

相关文章:

c# - 如何为具有共享类型的多个 WCF 服务生成客户端代码

python - 将参数传递给 Python subprocess.Popen

python - TypeError : 'str' object is not callable with input()

python - 如何使用 Django migrate 命令跳过迁移?

windows - 如何创建右键单击上下文 shell 快捷方式 "edit with Emacs"?

windows - Unix UID 与 Windows SID - 为什么?

java - SOAP 体采用 utf-8 编码两次

python - python/django 中巨型 heredoc 的上下文替代

c++ - 在未初始化局部变量的情况下,Windows 线程堆栈保护页面机制如何工作?

web-services - 从 Azure Web 应用程序使用 SOAP Web 服务