我使用这样的命令:
获取-pfxcertificate C:\test.pfx
输入密码: *******
该命令要求我填写提示。但我不能在我的脚本中做到这一点(例如 test.ps1)
我需要的是这样的:
get-pfxcertificate C:\test.pfx -password "123456"
或类似的东西,这样我就可以运行我的脚本而无需每次都填写提示
我非常感谢任何回复
最佳答案
没有 Password 参数,您可以尝试使用 .NET 类:
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import('C:\test.pfx','123456','DefaultKeySet')
关于powershell - 如何在powershell脚本中填写提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14049002/