0
votes

In powershell I have my sentences all blank I wanted to change the color of the first word to yellow just for appearance how can I do this?

I've tried using this command "Set-PSReadLineOption -Colors @{ Command = 'Yellow' }" but it gives me this error "Set-PSReadLineOption : The term 'Set-PSReadLineOption' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if the path was included, verify that the path is correct and try again."

1
What version of PowerShell are you using?jfrmilner
@jfrmilner 5.1.19041.1151GuyPeace
You need the PSReadLine module. To install PSReadLine 2.1.0 in a supported version of PowerShell run the following command. Install-Module -Name PSReadLine -RequiredVersion 2.1.0 docs.microsoft.com/en-us/powershell/module/psreadline/about/…ExcèsRefusé
The latest version of the PSReadLine module still supports 5.1 so install that, it defaults to Yellow for CommandColor.jfrmilner

1 Answers

3
votes

Something like this would set the first word to be coloured yellow and the rest of the line white:

Write-Host "YELLOW" -Foreground Yellow -NoNewLine
Write-Host " the rest of the line is white" -Foreground White

Which would output: YELLOW the rest of the line is white