Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting output to HTML format in PowerShell

Tags:

powershell

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?

like image 789
Naveen Avatar asked May 14 '11 06:05

Naveen


People also ask

How do I convert PowerShell to HTML?

The ConvertTo-Html cmdlet converts . NET objects into HTML that can be displayed in a Web browser. You can use this cmdlet to display the output of a command in a Web page.

How do I display output in a Table format in PowerShell?

Using Format-Table for Tabular Output. If you use the Format-Table cmdlet with no property names specified to format the output of the Get-Process command, you get exactly the same output as you do without a Format cmdlet. By default, PowerShell displays Process objects in a tabular format.

How do I read an HTML file in PowerShell?

Get-Content cmdlet is used to read content of a html file.


1 Answers

Use select-object in place of format-list.

like image 67
Emiliano Poggi Avatar answered Sep 22 '22 01:09

Emiliano Poggi