如何在PowerShell窗口中的两个引号之间更改文本颜色 [英] How to change text color between two quotes in PowerShell window

查看:176
本文介绍了如何在PowerShell窗口中的两个引号之间更改文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能在两个引号之间更改文本颜色(现在它的颜色是深蓝色). 我在哪里可以设置此设置或必须执行哪个命令?

I can't change the text color between two quotes (now its color is durk-blue). Where can I set up this setting or which command I have to execute?

样本

推荐答案

PSReadline v1.x(与Windows PowerShell v5.1一起提供):

PSReadline v1.x (as shipped with Windows PowerShell v5.1):

Set-PSReadlineOption -TokenKind String -ForegroundColor Green

PSReadline v2.x(与PowerShell Core 6.1.0一起提供):

PSReadline v2.x (as shipped with PowerShell Core 6.1.0):

Set-PSReadLineOption -Colors @{ String = 'Green' }

在两种情况下,您都可以使用 枚举类型.

In both cases you can use the colors defined in the [ConsoleColor] enumeration type.

在v2.x中,您也可以使用虚拟终端转义序列.

In v2.x you can alternatively use Virtual Terminal escape sequences.

请参见 Get-Help Set-PSReadlineOption

这篇关于如何在PowerShell窗口中的两个引号之间更改文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆