代码之家  ›  专栏  ›  技术社区  ›  Z-Y.L

找不到与参数名称“TokenKind”匹配的参数

  •  3
  • Z-Y.L  · 技术社区  · 6 年前

    this blog ,但是 Operator Parameter

    enter image description here enter image description here

    所以我改变他们的颜色 Set-PSReadlineOption :

    Set-PSReadlineOption -TokenKind Operator -ForegroundColor Yellow
    

    但会出现以下错误:

    找不到与参数名称“TokenKind”匹配的参数

    ¨ è:1 : 22

    • 设置PSReadlineOption-TokenKind操作符-ForegroundColor黄色
      • FullyQualifiedErrorId:未找到NamedParameters,Microsoft.PowerShell.SetPSReadLineOption

    但是 help 文件 设置PSReadlineOption 显示它有一个 TokenKind 作为其参数。

    我不明白为什么会发生这种错误。

    我的powershell版本是

    enter image description here

    1 回复  |  直到 4 年前
        1
  •  14
  •   cape_bsas    4 年前

    https://github.com/lzybkr/PSReadLine/issues/738

    所以

    Set-PSReadlineOption -TokenKind String -ForegroundColor Magenta
    Set-PSReadlineOption -TokenKind Variable -ForegroundColor Cyan
    

    $colors = @{}
    $colors['String'] = [System.ConsoleColor]::Magenta
    $colors['Variable'] = [System.ConsoleColor]::Cyan
    Set-PSReadLineOption -Colors $colors
    

    here .

    推荐文章