【发布时间】:2011-05-14 06:31:07
【问题描述】:
我正在学习 PowerShell。在我的实验中,我使用了以下命令:
PS C:\Windows\system32> gci -path C:\windows\ | Where-Object{$_.LastWriteTime -
gt "01-04-2011"} | Format-List -property Fullname | ConvertTo-Html | out-file E:
\PowerShell\Out.html
我希望输出类似于控制台中显示的输出(例如:FullName:C:\Windows...)。但是当我打开 Out.html 时,它有一些奇怪的东西,比如:
ClassId2e4f51ef21dd47e pageHeaderEntry pageFooterEntry autosizeInfo shapeInfo groupingEntry
我在这里错过了什么?
【问题讨论】:
-
您是否应该使用
Format-Table或Select-Object代替Format-List?或者你应该在Where-Object之后直接附加ConvertTo-Html -
我也试过
Format-Table..没有任何区别。 -
尝试在
where-object之后直接附加ConvertTo-Html -
@empo:你是对的..我应该使用
Format-List而不是Select-Object。如果您可以将其发布为答案,我会接受。
标签: powershell