none
Can I automate a batch script to automatically input test upon a prompt? RRS feed

  • Question

  • Hi,

    I have a batch file that is importing a Java certificate but everytime I do this it prompts for a destination password:

    C:\Users\user\Desktop\Java_>"C:\Program Files\Java\jre8\bin\keytool.exe" -importkeystore -srckeystore ".\trusted.certs" -destkeystore "%userprofile%\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs"
    Enter destination keystore password:

    My batch file is this:

    "C:\Program Files\Java\jre8\bin\keytool.exe" -importkeystore -srckeystore ".\trusted.certs" -destkeystore "%userprofile%\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs" 
    Is there a way upon the prompt to automatically enter in the password? I know the password. TIA

    Thursday, January 25, 2018 3:13 PM

Answers

All replies

  • That depends entirely on the behavior of the keystore.exe program.

    We didn't write that program or have any control over its behavior.

    You need to ask the author of that program (Oracle, probably) how to automate it.

    It may be that the answer is "you can't do that," but you need to ask the appropriate party.


    -- Bill Stewart [Bill_Stewart]

    Thursday, January 25, 2018 4:02 PM
    Moderator
  • Got it working using << in the batch file.
    • Marked as answer by GibsonLP2012 Monday, January 29, 2018 1:13 PM
    Monday, January 29, 2018 1:13 PM