我编写了一个脚本来自动生成.jks文件。但我很难回答如何回答cmd中的提示。 脚本:
keytool -genkey -keyalg RSA -alias selfsigned -keystore C:\keystore5.jks -storepass password -validity 360 -keysize 2048
- Ahad Paracha /
- Company /
- NY /
- NY /
- US /
- yes
提示是:
Enter keystore password:
Re-enter new password:
What is your first and last name?
[Unknown]: - Ahad Paracha /
- Company /
- NY /
- NY /
- US /
- yes
What is the name of your organizational unit?
[Unknown]:
What is the name of your organization?
[Unknown]:
What is the name of your City or Locality?
[Unknown]:
What is the name of your State or Province?
[Unknown]:
What is the two-letter country code for this unit?
[Unknown]:
Is CN=Ahad Paracha, OU=, O=, L=, ST=, C= correct?
[no]:
它只会在第一个问题上回答其他问题。我正在为CMD写这篇文章。
答案 0 :(得分:0)
PowerShell可以将字符串传递给交互式提示:
示例:
'help', 'rescan' | diskpart
在您的情况下,您可以尝试:
'Ahad Paracha', 'Company', 'NY', 'NY', 'US', 'yes' | keytool -genkey -keyalg RSA -alias selfsigned -keystore C:\keystore5.jks -storepass password -validity 360 -keysize 2048