我有一个在Windows 7的本地计算机上运行良好的脚本。当我尝试在另一个正在运行的Windows Server 2012上运行它时,我收到错误:
Invalid Parameter - Files
我在服务器计算机上安装了ImageMagick,并且可以访问所有路径。我不明白我应该排除什么。有什么想法吗?
更新:我看到了,因为我在单词" Files"之前有一个空格。在我的源路径中,这可能会导致问题。但是不确定如何强行路径。
我的脚本是:
# PowerShell script
# Date: 21/04/2016
# Purpose: Used to convert the first page of a TIF to a PDF file
# Basic concept - using ImageMagick
# convert source.pdf[0] output.jpeg
#TIFF source folder
$source = "\\Server12\US Files\NV"
# Select first page of TIFs in folder and convert them to PDFs
Get-ChildItem -Path $source -filter *.tif | %{ convert "$($_.FullName -Replace ".tif+$", ".tif[0]")" "C:\US\NV\$($_.Name -Replace ".tif+$", ".pdf")" }