

It will pause forever and ever, until the user enters data, or until the computer either restarts or shuts down. There is, of course, one teeny tiny problem with the script as written. When the PauseScriptReadName.ps1 script runs in the Windows PowerShell ISE, a pop-up window appears, as shown in the following image. One such example is pausing a script to wait for user input. Those would make a wonderful present for my significant other.Īnyway, TC, sometimes things are so simple that they do not receive much publicity. I fell in love with Tasmanian strawberries when I was in Sydney because they are super sweet, but recently they have started growing strawberries that are in the shape of a heart. Tasmania is one of the places I have not had the chance to visit. It was fun, but I would rather have been there in person. I was up late last night talking to the System Administrators Guild of Australia (SAGE-AU) at their conference in Tasmania. Is the absence of a solution indicative that I cannot accomplish this using Windows PowerShell? I also found an article called Can I Pause and Resume Scripts with Windows PowerShell? that was written for the 2009 Summer Scripting Games, but that does not work with user input. I do not think I want to attempt using stdin from a Windows PowerShell script. I found an old Hey, Scripting Guy! post called How Can I Pause a Script and Then Resume It When a User Presses a Key on the Keyboard? but it is written for VBScript.

When the user types a particular key on the keyboard, I would like the script to continue. Hey, Scripting Guy! I would like to pause a Windows PowerShell script and wait for user input.

Summary: Pausing execution of a Windows PowerShell script to receive keyboard input can be as simple as using the Read-Host cmdlet.
