I have a Powershell script that needs to execute a command-line executable that prompts for user input (for which there is no command-line parameter). Something like this:
# promptsForInput.ps1
$someInput = Read-Host "Gimme some input"
# do something with $someInput
The actual executable is a compiled binary which I cannot modify, but this example script do for the purposes of this question. My Powershell script calls the executable:
# myScript.ps1
.\promptsForInput.ps1
At runtime, I get prompted to input something:
> .\myScript.ps1
Gimme some input:
I need to be able to fill in that input request without user intervention. When promptsForInput.ps1
prompts for user input, I need myScript.ps1
to enter the required value and proceed with script execution.
Similar questions on SO either have answers specific to the particular exe, or are otherwise unhelpful:
$input
was just used for the example (I'll change it); like I said, the actual program being called is a binary. – Gard