rw0*_*026 8 powershell intellij-idea
如何在powershell中更改命令颜色?目前它是黄色的,当我使用嵌套在 Intellij 中的 powershell 时,我无法读取白色背景上的黄色命令。
关于@LotPings 的回答,我解决了我的问题。powershell 中的以下命令将命令颜色从黄色更改为绿色:
Set-PSReadLineOption -colors @{ Command = "Green"}
Run Code Online (Sandbox Code Playgroud)
您还可以在终端设置中设置环境变量:
然后编辑你的 powershell 配置文件并添加如下内容:
if ($env:CommandColor) {
Set-PSReadLineOption -colors @{ Command = $env:CommandColor}
}
Run Code Online (Sandbox Code Playgroud)
小智 5
请参阅 cmdlet Get-PSReadlineOption和Set-PSReadlineOption
您可能想要更改:
Set-PSReadlineOption -Tokenkind Command -BackgroundColor Black
Run Code Online (Sandbox Code Playgroud)
或查看当前设置:
> Get-PSReadlineOption
EditMode : Windows
ContinuationPrompt : >>
ContinuationPromptForegroundColor : DarkYellow
ContinuationPromptBackgroundColor : DarkMagenta
ExtraPromptLineCount : 0
AddToHistoryHandler :
CommandValidationHandler :
CommandsToValidateScriptBlockArguments : {ForEach-Object, %, Invoke-Command, icm...}
HistoryNoDuplicates : False
MaximumHistoryCount : 4096
MaximumKillRingCount : 10
HistorySearchCursorMovesToEnd : False
ShowToolTips : False
DingTone : 1221
CompletionQueryItems : 100
WordDelimiters : ;:,.[]{}()/\|^&*-=+'"–—?
DingDuration : 50
BellStyle : Audible
HistorySearchCaseSensitive : False
ViModeIndicator : None
HistorySavePath : C:\Users\LotPings\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\Cons
oleHost_history.txt
HistorySaveStyle : SaveIncrementally
DefaultTokenForegroundColor : DarkYellow
CommentForegroundColor : DarkGreen
KeywordForegroundColor : Green
StringForegroundColor : DarkCyan
OperatorForegroundColor : DarkGray
VariableForegroundColor : Green
CommandForegroundColor : Yellow
ParameterForegroundColor : DarkGray
TypeForegroundColor : Gray
NumberForegroundColor : White
MemberForegroundColor : White
DefaultTokenBackgroundColor : DarkMagenta
CommentBackgroundColor : DarkMagenta
KeywordBackgroundColor : DarkMagenta
StringBackgroundColor : DarkMagenta
OperatorBackgroundColor : DarkMagenta
VariableBackgroundColor : DarkMagenta
CommandBackgroundColor : DarkMagenta
ParameterBackgroundColor : DarkMagenta
TypeBackgroundColor : DarkMagenta
NumberBackgroundColor : DarkMagenta
MemberBackgroundColor : DarkMagenta
EmphasisForegroundColor : Cyan
EmphasisBackgroundColor : DarkMagenta
ErrorForegroundColor : Red
ErrorBackgroundColor : DarkMagenta
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9466 次 |
| 最近记录: |