0

So i am receiving the following error in Powershell

.\nconvert.exe :   Error: Can't create file (\\vm912test\c$\JCL Testing\Converted Output\2013\06\MMM7777.pdf)
At M:\Powershell\test4.ps1:61 char:8
+        .\nconvert.exe -quiet -out pdf -c 3 -multi -n 1 $PageCount 1 -o "$OutputL ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (  Error: Can't ...06\MMM7777.pdf):String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

If anyone has any experience working with nConvert that could help that would be great.
The line of code that i am using is:

.\nconvert.exe -quiet -out pdf -c 3 -multi -n 1 $PageCount 1 -o "$OutputLocation\$Year\$Month\$BusinessUnit$CheckNumber.pdf" "$TIFPath\$pattern####.tif"
EBGreen
  • 36,735
  • 12
  • 65
  • 85
Peter3
  • 2,549
  • 4
  • 20
  • 40

1 Answers1

0

You need to add quotation marks to the output filename, because it countains spaces. I usually do this to force an external command to be formated exactly as I want it to be:

$myCommand = "nconvert -q 100 -out tif -overwrite -o " + ('"' + $OutputFilePath + '"') + " " + ('"' + $InputFilePath + '"')

write-host $myCommand

invoke-expression $myCommand

Use write-host to check the formating and run the command verbatim using invoke-expression.