编写这个powershell脚本来尝试签名一个jar文件。在构建了正确的命令之后,它看起来像这样:
$command = "jarsigner -storetype pkcs12 -keystore $certToUse -signedjar $nameOfSignedJar $nameOfJarToSign $defaultAlias"
Write-Output $command
Invoke-Expression $command
Write-Output行输出:
jarsigner -storetype pkcs12 -keystore MyCertificate.p12 -signedjar signed_sample.jar sample.jar "this is my test alias, inc.'s comodo ca limited id"
然而,当调用表达式运行时,它基本上只是挂起,没有其他事情发生。如果我在powershell中运行这个命令,系统会提示我输入密码,然后对JAR文件进行签名。
我做错了什么,我怎么能使它,当它问我的密码,然后我可以通过相同的脚本传递它?
可能是$default别名中未转义引号的问题:
$defaultalias = "`"this is my test alias, inc.`'s comodo ca limited id`""
显然问题出在PowerShell ISE上。