Freigeben über


PowerTip: Display a Blinking Message by Using PowerShell

Summary: Use this one-line Windows PowerShell command to display a blinking message.

Hey, Scripting Guy! Question Is there a one-line command that I could use to blink a message in the Windows PowerShell console to get the users attention?

Hey, Scripting Guy! Answer Pipe a range of numbers to the Foreach-Object cmdlet ( %  is an alias), clear the screen in the Begin block,
          and then display the message, pause, clear the screen, and pause in the Process block:

1..3 | % -begin {cls} -process {"hello";sleep 1;cls;sleep 1}