How to run these set of sh commands in bat file?

倖福魔咒の 提交于 2019-12-24 21:21:53

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!