RGT1 Posted November 11, 2022 Share Posted November 11, 2022 I'm launching Switch within a Microsoft PowerShell script. When the script launches Switch with the parameters passed to it, it runs fine. However; the script continues to the next line of code. How do I make the script wait until Switch has completed its process before continuing to the next line of code in the PowerShell script? Link to comment Share on other sites More sharing options...
MakubX Posted November 11, 2022 Share Posted November 11, 2022 Which command lines are you using exactly could you confirm the exact steps? You may also send a support ticket for this incase it needs clarification from the devs https://www.nch.com.au/support/supportcontact.html Link to comment Share on other sites More sharing options...
mediajf Posted November 12, 2022 Share Posted November 12, 2022 you can try adding the -wait option at the end of the command see below for a example Start-Process -FilePath "c:\temp\example.bat" -Wait Link to comment Share on other sites More sharing options...
RGT1 Posted November 12, 2022 Author Share Posted November 12, 2022 Thanks! Looks like I did the hard way. I forgot about Start-Process. & $exe -hide -outfolder $TargetFolder -convert $SourceFile -format $Format -settings $Settings -overwrite ALWAYS do { $Switch = Get-Process | Where-Object {$_.ProcessName -eq "switch"} $counter = 0 foreach ($item in $Switch) { if ($_.CPU -gt 0) { $counter += 1 } } } until ($counter -eq 0) Link to comment Share on other sites More sharing options...
mediajf Posted November 12, 2022 Share Posted November 12, 2022 if it works, it works, another way is just to tell it to pause for x amount of time before starting the next process. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now