【发布时间】:2023-04-05 01:12:01
【问题描述】:
我在 PowerShell 中编写了一个脚本,并且在不同的计算机上调用 Image Magick 的 montage.exe 取得了各种成功。我编写脚本的计算机执行“蒙太奇”命令没有问题,但是在另一台安装了 IM 的计算机上脚本错误:
montage : The term 'montage' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At \\Server\Contact_Sheet_Local.ps1:51 char:9
+ montage -verbose -label %t -pointsize 20 -background '#FFFFFF ...
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (montage:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我尝试过使用montage.exe,甚至尝试了整个路径C:\Program Files\ImageMagick-7.0.3-Q16\montage.exe。另外我尝试先设置目录:
Set-Location -Path 'C:\Program Files\ImageMagick-7.0.3-Q16'
montage...
每次在特定计算机上都会失败。我试过 IM 版本 7.0.3-Q16 和 6.9.1-6-Q8 都是 x64,因为两台计算机都是 x64
过去,我在 .bat 中创建了使用 ImageMagick 的脚本,并且我必须定义 .exe 的完整路径,如上所述。但这在 PowerShell 中似乎没有帮助。
有人对这个问题有任何建议或经验吗?
【问题讨论】:
-
.\montagePowerShell 不会搜索当前工作目录,除非您指定它。
标签: powershell imagemagick imagemagick-montage