Last active
November 14, 2022 23:25
-
-
Save PrateekKumarSingh/c44fbda1f0b6c34434f523e566c204ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Create-HTMLDOMFromFile | |
{ | |
Param( | |
[String] $FileName, | |
[String] $TagName, | |
[Int] $OuputCount = 11 | |
) | |
$HTML = New-Object -Com "HTMLFile"; | |
$Content = Get-Content -Path $FileName -raw | |
#To convert raw content to HTML DOM (Document object Model) and 2 stands for DOM level 2 | |
$HTML.IHTMLDocument2_write($Content) | |
#Some data wrangling to extract the exact information | |
$HTML.all.tags($TagName) | select innertext -ExpandProperty innertext -First $OuputCount | |
} | |
#Create-HTMLDOMFromFile -FileName 'C:\Temp\DecompiledHTML\Command_Line_Options.htm' -TagName 'P' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment