IBM WS MQ7.5,windows MQMFT代理,linux MQ管理器。
我试图运行mft ant脚本的xml中定义的powershell脚本。
我配置了到commandPath中的agent.properties文件的powershell脚本的路径。
托管调用启动,但失败。
<fte:presrc command="C:\IBM\MFT\script\MoveFileToArchive.ps1" successrc="0">
<fte:arg value="${base.file}"/>
</fte:presrc>错误读取
无法运行程序创建进程error=193 MoveFileToArchive.ps1不是有效的win32应用程序
我尝试将路径添加到powershell中,powershell.exe定义如下
<fte:presrc command="C:\windows\system\windowspowershell\v.1.0\powershell.exe C:\IBM\MFT\script\MoveFileToArchive.ps1" successrc="0">
<fte:arg value="${base.file}"/>
</fte:presrc>这也不管用。
发布于 2016-10-14 04:52:59
从错误中可以看出,MFT正在使用CreateProcess API启动程序。CreateProcess API只能运行可执行文件。您使用的Powershell脚本是不可执行的。因此出现了错误。
如果您希望能够打开任何文件及其关联的应用程序,那么您需要ShellExecute而不是CreateProcess。但这不是你能控制的。那么需要寻找替代方案吗?
尝试使用批处理文件,比如ps.cmd,然后在批处理文件中运行PowerShell脚本,如下
Powershell -executionpolicy bypass -File C:\IBM\MFT\script\MoveFileToArchive.ps1 %1其中%1将是PS脚本的参数。
Ant脚本还需要进行一些更改。
<fte:presrc command="ps.cmd" successrc="0">
<fte:arg value="${base.file}"/>
</fte:presrc> 我相信您已经将commandPath属性设置为agent.properties中的适当值。
试试看。
https://stackoverflow.com/questions/40032066
复制相似问题