PowerTip: Easily Pause a PowerShell Script for a Process to End

PowerTip: Easily Pause a PowerShell Script for a Process to End

  • Comments 1
  • Likes

Summary: Learn how to pause a Windows PowerShell script and wait for another process to end prior to continuing.

Hey, Scripting Guy! Question How can you easily pause a Windows PowerShell script and wait for a specific process to end prior to continuing execution?

Hey, Scripting Guy! AnswerUse the Wait-Process cmdlet. It will wait for either a process name, a process ID, or even a specified time-out interval, as shown here.

Wait-Process -Name notepad

 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Also the pause command is back in PS v3. Good ol "Press Any key to continue. . ."