Change color of first input word in PowerShell

Update: Use this command instead for newer versions:

Set-PSReadLineOption -Colors @{ Command = 'Red' }

Color list:

  • Black
  • DarkBlue
  • DarkGreen
  • DarkCyan
  • DarkRed
  • DarkMagenta
  • DarkYellow
  • Gray
  • DarkGray
  • Blue
  • Green
  • Cyan
  • Red
  • Magenta
  • Yellow
  • White

The syntax highlighting comes from PSReadLine. To set the foreground color for Command tokens (which shows in yellow by default), use Set-PSReadLineOption:

Set-PSReadlineOption -TokenKind Command -ForegroundColor DarkGreen

Place that statement in your $profile to have it run every time you launch PowerShell:

'Set-PSReadlineOption -TokenKind Command -ForegroundColor DarkGreen' |Add-Content $Profile

Tags:

Powershell