Posted On December 17, 2022

How to Set PowerShell Window and Prompt Title or Label

kimconnect 0 comments
blog.KimConnect.com >> Windows >> How to Set PowerShell Window and Prompt Title or Label

Have you ever wondered about changing the boring PS C:\Windows\system32> whenever a new window is opened in PowerShell? You’re in luck by finding this quick note. Here’s how you’d do it:

# Set Window title to match current machine name
$host.UI.RawUI.WindowTitle="PS $env:computername $env:username"

# Set Window prompt to match current machine name
function prompt {"PS $env:computername $env:username> "}

# Set color of label
function prompt{
Write-Host ("PS $env:computername $env:username> ") -nonewline -foregroundcolor Yellow
return " "
}

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Windows Update Error

Error Message: There were some problems installing updates, but we'll try again later. If you…

How to Repair Windows Using CD or USB flash drive

Scenario 1: after PAEPATCH 32Bit Windows to use more than 3.5 GB or RAM, sometimes…

How to Install SSL Certificate(s) on Various Web Servers

Public facing websites often become become targets of attacks such as eavesdropping, denial of service,…
Other project: DragonCoin.com