【问题标题】:VSCode Powershell terminal - truncating linesVSCode Powershell 终端 - 截断行
【发布时间】:2021-10-27 16:11:18
【问题描述】:

我正在尝试找出为什么我不断收到此错误

不是“名称=值”格式

有没有办法让 VSCode 在其终端中运行命令时关闭截断? b/c 我正在寻找的那部分数据正是被截断的!

    d5a2dd24f79c56d88e4e20b6c8a... My Pictures/Kaelyn/Automatic Upload/iPhone/2020-11-05 10-03-02.904.jpeg
ConvertFrom-StringData : Data line '                           ERROR  My Pictures/Kaelyn/Automatic Upload/iPhone/2020-11-05 10-03-02.703.jpeg' is not in 'name=value' format. 
At line:1 char:54
+ ... efiles -replace '^[a-f0-9]{32}(  )', '$0=  ' | ConvertFrom-StringData
+                                                    ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [ConvertFrom-StringData], PSInvalidOperationException
    + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.ConvertFromStringDataCommand

【问题讨论】:

    标签: powershell visual-studio-code


    【解决方案1】:

    你要设置的是$FormatEnumerationLimit偏好变量。

    设置 $FormatEnumerationLimit = -1 以禁用 PowerShell 中的输出截断。默认设置为4。这个数字表示在截断输出之前给定属性默认枚举的对象数,我们可以看到堆栈跟踪的第一行在该行倒数第二个单词的中间被截断。


    对于您的具体情况,您也可以通过拆开$Error[0] 来更仔细地检查错误。 $Error is an automatic variable 数组,其中包含有关当前 PowerShell 会话中发生的异常的信息。最近的异常将是第一个 (0) 索引,索引的每一次递增都表示按发生顺序排列的前一个错误。

    具体来说,$Error[0].Exception 应该为您提供您正在寻找的信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-15
      相关资源
      最近更新 更多