问题
I need to run this sh commands. First, the command will be this one
keytool -importcert -file myfile.cer -keystore keystore.jks -alias "Aliasname"
Enter keystore password:
Re-enter new password:
Trust this certificate? [no]:
I need to run this commands automatically, And when the first command is successful. It asks for a password. I need to enter it automatically. and finally yes. How to do that using .bat file?
回答1:
If keytool is compliant with standard input, you can use:
(
echo your_password
echo your_password
echo y
)|keytool -importcert -file myfile.cer -keystore keystore.jks -alias "Aliasname"
来源:https://stackoverflow.com/questions/48438559/how-to-run-these-set-of-sh-commands-in-bat-file