我正在使用 powershell 4 调用 Mirth Connect command line interface (mccommand.exe)。我明确避免使用 Mirth CLI 的“-s”参数来传递 Mirth 脚本文件,因为我想将动态命令传递给 Mirth Shell。
当我从交互式 powershell 控制台调用 mccommand.exe 时,我能够连接到 Mirth Connect 服务器和 Mirth Shell已打开,我可以在其中运行一个或多个 Mirth Shell 命令来管理 Mirth Channels。
例子:
. "C:\Program Files (x86)\Mirth Connect\mccommand.exe" -a "https://localhost:8443" -u admin_user -p admin_password
Connected to Mirth Connect server @ https://localhost:8443 (3.4.1.8057)
$
当我通过 Windows Powershell ISE 从 powershell 脚本中运行相同的命令时,我收到相同的“已连接到 Mirth Connect 服务器 @ https://localhost:8443 (3.4.1.8057)”消息,但脚本等待并且我从未收到“$”命令提示符,允许我将 Mirth Shell 命令传递给 Mirth。
关于如何通过 Powershell 脚本将命令路由到 Mirth Shell 有什么想法吗?
最佳答案
因此您必须将所有 mirth shell 命令作为文本文件传递。 这就是我用来导入和部署任何 channel 的方式。
按照下面的代码:
Set-Location 'C:\Mirth Connect'
$ChannelOutput=.\mccommand.exe -a https://localhost:38443 -u username -p password -s "C:\commands.txt"
If($ChannelOutput -like '*successfully*')
{
"Channel created successfully and deplyed"
}
else
{
$_.Exception.Message
}
文本文件应包含如下命令集:
Commands.txt:
import "C:\TestServiceChannel1.xml" Force
channel deploy "Channel_name"
关于shell - 使用 Powershell 脚本调用 Mirth Connect CLI,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38400543/