6

I am learning PowerShell. During my experiments I used the following command:

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

I expected the output like the one displayed in the console (like:FullName:C:\Windows...). But when I open the Out.html it has some strange things like:

ClassId2e4f51ef21dd47e pageHeaderEntry pageFooterEntry autosizeInfo shapeInfo groupingEntry

What am I missing here?

4
  • Shouldnt you use Format-Table or Select-Object in place of Format-List? Or you should append ConvertTo-Html directly after the Where-Object Commented May 14, 2011 at 6:38
  • I tried Format-Table too..didn't make any difference. Commented May 14, 2011 at 6:40
  • Try appending ConvertTo-Html directly after where-object Commented May 14, 2011 at 6:43
  • @empo: You were right..instead of Format-List I should use Select-Object. If you can post that as an answer I will accept it. Commented May 14, 2011 at 6:49

3 Answers 3

6

Use select-object in place of format-list.

Sign up to request clarification or add additional context in comments.

Comments

2

Handle Formatted Output in PowerShell

Comments

0
cmd:
powershell gci -path %windir% ^| ?{$_.LastWriteTime -gt (Get-Date -Year 2011 -Month 04 -Day 01)} ^| Format-List -property Fullname | more


PS>gci -path %windir% | ?{$_.LastWriteTime -gt (Get-Date -Year 2011 -Month 04 -Day 01)} | Format-List -property Fullname | more

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.