The following script works for me:
$sImageMagickHome = "C:devim"
$sImageMagickConv = "$sImageMagickHomeconvert.exe"
$sImageMagickArgs = @('-background', 'transparent',
'-fill', 'hsb(0,0,0)',
'-font', 'Arial',
'-pointsize', '18',
'-size', '18x26',
'-gravity', 'center')
for ( $i = 65; $i -le 67; $i++ )
{
$y = [char]$i
& $sImageMagickConv $sImageMagickArgs label:$y c:dev$y.bmp
}
Note that you cannot just Write-Host
the arguments and try running it from command line, Powershell does special processing for &
operator (adds quotes where needed), which it does not when you pass same arguments to Write-Host
.
You'd probably want to install PSCX and play around with echoargs
utility bundled with it to gain better understanding of how arguments are passed.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…