如何防止 Powershell 在 Linux 上重定向输出时假设 80 列宽度输出
How to prevent Powershell from assuming 80 columns width output when redirecting output on Linux
当我在 Linux 上执行以下 PowerShell 脚本时:
dir
通过以下方式:
pwsh test.ps1 > output.txt
output.txt
中的输出限制为 80 列。
我怎样才能防止这种行为? Linux 不支持修改 $host.UI.RawUI.BufferSize
。
我认为 pwsh
输出重定向将假定标准文件宽度。
但是可以设置一个宽度里面pwsh
.
PS> .\test1.ps1 | Out-File z -Width 60
或
pwsh -c ".\test1.ps1 | Out-File z -Width 60"
当我在 Linux 上执行以下 PowerShell 脚本时:
dir
通过以下方式:
pwsh test.ps1 > output.txt
output.txt
中的输出限制为 80 列。
我怎样才能防止这种行为? Linux 不支持修改 $host.UI.RawUI.BufferSize
。
我认为 pwsh
输出重定向将假定标准文件宽度。
但是可以设置一个宽度里面pwsh
.
PS> .\test1.ps1 | Out-File z -Width 60
或
pwsh -c ".\test1.ps1 | Out-File z -Width 60"