How to execute .exe file silently using powershell?

185 Views Asked by At

I want to execute .exe file, but after executing the tool need to type y/n then enter to continue the process. Is it possible to execute it without any human intervention by typing y/n and enter?

Thank you so much for the idea.

1

There are 1 best solutions below

0
SE1986 On

How about using a while loop until the correct character is entered:

# run the exe
calc.exe

$response = "N"

while ($response -ne "Y")
{
    $response = Read-Host -Prompt "Press Y/N"
}

# this is the rest of the process
Write-host "continuing the process"