您必须在'%'运算符之后提供一个值表达式 [英] You must provide a value expression following the '%' operator
问题描述
PS C:\ImageMagick> convert -background transparent -fill hsb(0%,0%,0%) -font Arial -pointsize 18 -size 18x26 -gravity center label:p "output2.png"
At line:1 char:51
+ convert -background transparent -fill hsb(0%,0%,0%) -font Arial -pointsize 18 -s ...
+ ~
You must provide a value expression following the '%' operator.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ExpectedValueExpression
上面的命令在cmd窗口中没有任何问题,在我上面粘贴的PowerShell中的红色文本中引发了一个错误.我看了很多文章,但还没有想出一个好的解决方案.
The command above which works without any trouble in a cmd window is throwing an error coming out in red text in PowerShell, which I have pasted above. I looked at a number of articles but have not come up with a good solution yet.
尽管我也许他们正在谈论对hsb
的调用,但我在引号中将其括起来:
I though perhaps they were talking about the call to hsb
which I surrounded in quotations:
PS C:\ImageMagick> convert -background transparent -fill "hsb(0%,0%,0%)" -font Arial -pointsize 18 -size 18x26 -gravity center label:p "output2.png"
Invalid Parameter - transparent
这只会导致另一个问题.我曾尝试在命令前加上&
前缀,这是我以前不熟悉的一种技术,但似乎并没有解决任何问题.
that just leads to a different problem. I have tried prefixing the command with &
, which is a technique I had been previously unfamiliar but that did not seem to solve anything.
推荐答案
PowerShell不会将当前目录用作查找命令的宫殿.所以convert
解析为C:\Windows\System32\convert.exe
PowerShell does not use current directory as palace for looking for commands. So convert
is resolved to C:\Windows\System32\convert.exe
Get-Command convert|ft CommandType,Name,Definition
# CommandType Name Definition
# ----------- ---- ----------
# Application convert.exe C:\Windows\System32\convert.exe
如果要从当前目录调用convert.exe
,请使用.\convert
而不是convert
.
If you want to invoke convert.exe
from current directory use .\convert
instead of convert
.
这篇关于您必须在'%'运算符之后提供一个值表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!