0
下面的命令在PowerShell中的工作:PowerShell的執行makecert與變量賦予太多的參數錯誤
$currentDirectory = Split-Path $Script:MyInvocation.MyCommand.Path
& "$currentDirectory\Makecert\makecert.exe" –sv actualCnName.pvk -n "cn=actualCnName" actualCnName.cer -r -eku 1.3.6.1.5.5.7.3.1
但我想這些參數,並使用變量名$ pvkName,$ cnName和$ cerName。執行時的錯誤:
$cnName = "actualCnName"
$pvkName = $cnName + ".pvk"
$cerName = $cnName + ".cer"
$pfxName = $cnName + ".pfx"
& "$currentDirectory\Makecert\makecert.exe" –sv $pvkName -n "cn=$cnName" $cerName -r -eku 1.3.6.1.5.5.7.3.1
是
[DBG]: PS C:\WINDOWS\system32>>
Error: Too many parameters
Usage: MakeCert [ basic|extended options] [outputCertificateFile]
Basic Options
-sk <keyName> Subject's key container name; To be created if not present
-pe Mark generated private key as exportable
-ss <store> Subject's certificate store name that stores the output
certificate
-sr <location> Subject's certificate store location.
<CurrentUser|LocalMachine>. Default to 'CurrentUser'
-# <number> Serial Number from 1 to 2^31-1. Default to be unique
-$ <authority> The signing authority of the certificate
<individual|commercial>
-n <X509name> Certificate subject X500 name (eg: CN=Fred Dews)
-? Return a list of basic options
-! Return a list of extended options
[DBG]: PS C:\WINDOWS\system32>>
想知道如何解決這個錯誤。
你考驗我的答案嗎? – JPBlanc
謝謝你的回答。我很抱歉拖延。我問了幾個相關的問題,並忙於測試這些問題。我會在接下來的兩天內儘快測試,然後回來。 – Romonov