How to check the readiness of PowerShell?

I have a simple command Process.Startthat takes a path powershellas input

Process.Start(powerShellPath);
Thread.Sleep(5000); //wait till loading is done, typically a couple of seconds

But now I use Thread.Sleepto wait until it powershellis completely ready (ready, I mean how: you can type / send something and respond, but we can know it before we enter / send something to powershell).

Is there a way to find out if it is ready powershellto wait, not time logic, but event-based logic

+4
source share
1 answer

Do you mean this?

Start-Process powershellPath -NoNewWindow -Wait
0
source

Source: https://habr.com/ru/post/1622572/


All Articles