当我使用 autosize 时,它只修复最后一列,然后打破第一列,这意味着所有值都显示在最后一列,第一列的值被截断了一半。有解决办法吗?
Get-SPSite -WebApplication http://contoso.intranet.com -Limit All | where {$_.RootWeb.Created -ge $Yesterday -And $_.RootWeb.Created -lt $Tomorrow} | ft Url, @{Name='Created';Expression={$_.RootWeb.Created}},@{label="Size in MB";Expression={$_.usage.storage/1MB}} | Format-Table -Wrap -AutoSize
Run Code Online (Sandbox Code Playgroud)
Format-Table -Autosize
仅限于屏幕缓冲区的宽度。一种选择是将其输出到文本文件或使用Out-GridView
而不是Format-Table
例如
Get-SPSite -WebApplication http://contoso.intranet.com -Limit All
| where {$_.RootWeb.Created -ge $Yesterday -And $_.RootWeb.Created -lt $Tomorrow}
| ft Url, @{Name='Created';Expression={$_.RootWeb.Created}},@{label="Size in MB";Expression={$_.usage.storage/1MB}}
| Format-Table -Wrap -AutoSize
| Out-String -Width 4096 `
| Out-File C:\SPSites.txt
Run Code Online (Sandbox Code Playgroud)
或者
Get-SPSite -WebApplication http://contoso.intranet.com -Limit All
| where {$_.RootWeb.Created -ge $Yesterday -And $_.RootWeb.Created -lt $Tomorrow}
| ft Url, @{Name='Created';Expression={$_.RootWeb.Created}},@{label="Size in MB";Expression={$_.usage.storage/1MB}}
| Out-GridView
Run Code Online (Sandbox Code Playgroud)
小智 7
这给出了您可能期望的输出类型:
[command] | Format-Table -AutoSize | Out-String -Width 10000 #| clip.exe
Run Code Online (Sandbox Code Playgroud)
例如,试试这个:
Get-ChildItem -Path "." | Select-Object * | Format-Table -AutoSize | Out-String -Width 10000 #| clip.exe
Run Code Online (Sandbox Code Playgroud)
Format-Table -AutoSize
适合预期的输出大小或元素的大小,以较小者为准。由于您的输出可能少于 10,000 个字符宽,因此该命令应该适合您的任何数据。
注意:clip.exe
是一个内置的 Windows 命令,可让您通过管道连接到剪贴板。
归档时间: |
|
查看次数: |
33433 次 |
最近记录: |