From a Powershell script I would like to run another application, which in this case is a Java app, and when that app asks a question via stardard in prompt I would like PowerShell to give it a response.
The Java app don't accept this data via command line arguments , instead it must be run interactively and expects responses to it's prompts. When run interactively the it goes through the following questions:
Question: Select your application? Answer: 7
Q: Are you sure? A: Y
Q: Online[1] or offline[2] A: 1
I've been able to get this to work automatically using 'echo' only for the first question via this script:
echo 7 | java -jar javaapp.jar
But attempts to get it to send to the subsequent prompts are ignored: commas between the options, `n [new lines] between the letters, or spaces, are all ignored.
Can anyone suggest an alternative way of doing this? Thanks