문제

I am using a Powershell 1 script to kick off a Python program, and I want to then pause the Powershell until the Python has completed its work. (I have complete ownership of the Python file.) What is the best way to go about this?

도움이 되었습니까?

해결책

Look at the help on the Wait-Process cmdlet:

man Wait-Process -full
start-process notepad -PassThru | Wait-Process

다른 팁

you can get the Process object or ID with the get-process commandlet to get the process object or you can get it like I show below either will work.

you can use the PID and call

$proc = [System.Diagnostics.Process]::GetProcessById($PID)
while(-not $proc.HasExited) {[System.Threading.thread]::sleep(500) }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top