powershell Color

Filip 831 Reputation points
2021-03-13T09:26:01.26+00:00

Hello everybody.
How can i change powershell background color with using powershell commands?
Thanks for answare

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,449 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Matthias Treutle 101 Reputation points
    2021-03-13T10:47:46.78+00:00

    Hi @Filip ,

    just type the following inside your powershell:
    $Host.UI.RawUI.BackgroundColor = 'Black'
    You can change Black with all other colors like Green, Red, Blue,...

    To change the colors of your letters for example to green, type the following:
    $host.ui.RawUI.ForegroundColor ='Green'

    To see the changes just clear your console window. These settings are temporary. If you want them to be persistent check, if you have already a profile file (Test-Path $profile). If you don't have a profile, you can create it using following command: New-Item -path $profile -type file -force
    Then fill the file with some information like for example
    $console = $host.ui.rawui
    $console.backgroundcolor = "black"
    $console.foregroundcolor = "white"
    $colors = $host.privatedata
    $colors.verbosebackgroundcolor = "Magenta"
    $colors.verboseforegroundcolor = "Green"
    $colors.warningbackgroundcolor = "Red"
    $colors.warningforegroundcolor = "white"
    $colors.ErrorBackgroundColor = "DarkCyan"
    $colors.ErrorForegroundColor = "Yellow"
    set-location C:\
    clear-host

    Best regards
    Matthias

    2 people found this answer helpful.
    0 comments No comments

  2. Andreas Baumgarten 103.2K Reputation points MVP
    2021-03-13T10:27:05.19+00:00
    0 comments No comments