PowerTip: Display a Blinking Message by Using PowerShell

PowerTip: Display a Blinking Message by Using PowerShell

  • Comments 10
  • Likes

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}

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • so much cool stuff its amazing seriously

  • Ultimate.

  • What if want the rest of the screen to stay intact, but we only want a specific line in the window to blink (let's say it's the last line) - is there a way to do this? Thanks!

  • This is really dorky because this isn't truly a blinking message that I would want to use, but rather a simulated blinking message:

    1..3 | % -begin {$msg = "hello"} -process {write-host -nonewline "`r$msg";sleep 1;write-host -nonewline ("`r" + (" " * $msg.Length));sleep 1}