问题描述
我正在使用Powershell 4调用 Mirth Connect命令行界面(mccommand.exe).我明确避免使用Mirth CLI的"-s"参数来传递Mirth脚本文件,因为我想将动态命令而不是传递给Mirth Shell.
I'm using powershell 4 to invoke the Mirth Connect command line interface (mccommand.exe). I am explicitly avoiding use of the "-s" parameter of the Mirth CLI to pass a Mirth script file because I want to pass dynamic commands instead to the Mirth Shell.
当我从交互式Powershell控制台调用mccommand.exe时,我能够连接到Mirth Connect服务器和 Mirth Shell 已打开,我可以在其中运行一个或多个Mirth Shell命令来管理Mirth通道.
When I invoke mccommand.exe from an interactive powershell console, I am able to connect to the Mirth Connect server and the Mirth Shell is opened where I can run one or more Mirth Shell commands to manage 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的"$"命令提示符.
When I run the same command from within a powershell script via the Windows Powershell ISE, I get the same "Connected to Mirth Connect server @ https://localhost:8443 (3.4.1.8057)" message but the script waits and I never get the "$" command prompt that allows me to pass Mirth Shell commands to Mirth.
关于如何通过Powershell脚本将命令路由到Mirth Shell的任何想法?
Any thoughts on how I can route commands to the Mirth Shell via a Powershell script?
推荐答案
因此,您必须将所有mirth shell命令作为文本文件传递.这就是我用来导入和部署任何渠道的方法.
So you have to pass all the mirth shell commands as text file. This is what I use to import and deploy any 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"
这篇关于使用Powershell脚本调用Mirth Connect CLI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!