Jump to content

Using Switch With PowerShell


RGT1

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...