Saturday, August 14, 2010

Batch to Powershell: Title

If you try to set the title of the window in powershell, 'title' won't work; but you can set the title using the $host object
 PS C:\> $Host.UI.RawUI.WindowTitle = "Donkey" 
You can also mess with other fun things like colors eg:
PS C:\>  $Host.UI.RawUI.BackgroundColor = [ConsoleColor]::Red 
If you're a big title user and have title burned into your muscle memory you can always create function called title e.g.:
 PS C:\Temp> function title ($t) {$host.UI.RawUI.WindowTitle=$t }
PS C:\Temp> title Donkey2 
Have fun moving into powershell.

No comments: