$sImageMagickHome = "C:ImageMagick"
$sImageMagickConv = "$sImageMagickHomeconvert.exe"
$sImageMagickArgs = @( '--%',
'-background transparent',
'-fill hsb(0,0,0)',
'-font Arial',
'-pointsize 18',
'-size 18x26',
'-gravity center')
for ( $i = 0x01; $i -le 0x05; $i++ )
{
$y = [char]$i
& $sImageMagickConv $sImageMagickArgs label:$y $sCharsDir$y.png
#Write-Host $sImageMagickConv $sImageMagickArgs label:$y $sCharsDir$y.png
}
Using Write-Host I can get an example to copy paste into the command line and I find it does run correctly if I run this single line from the PowerShell prompt:
C:ImageMagickconvert.exe --% -background transparent -fill hsb(0,0,0) -font Arial -pointsize 18 -size 18x26 -gravity center label:? C:Userserics_000DesktopOutputChars?.png
Using the call operator '&' from inside the script does not work at all however and leads to some error messages:
convert.exe: UnableToOpenBlob `--%': No such file or directory @ error/blob.c/OpenBlob/2697.
convert.exe: NoDecodeDelegateForThisImageFormat `' @ error/constitute.c/ReadImage/501.
convert.exe: UnrecognizedOption `-background transparent' @ error/convert.c/ConvertImageCommand/858.
The article I have been reading is: http://social.technet.microsoft.com/wiki/contents/articles/7703.powershell-running-executables.aspx
Thank you...
See Question&Answers more detail:os