Skip to content

Instantly share code, notes, and snippets.

@PrateekKumarSingh
Last active July 7, 2016 03:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PrateekKumarSingh/b528e2b3e7d728d5fdda38105690d074 to your computer and use it in GitHub Desktop.
Save PrateekKumarSingh/b528e2b3e7d728d5fdda38105690d074 to your computer and use it in GitHub Desktop.
Function Get-DecompiledHTMLHelp
{
[cmdletbinding()]
param(
[String] $Destination, [String]$Filename
)
$EXE = 'C:\Windows\hh.exe'
If(-not (Test-Path $destination))
{
"Destination folder doesn't exist"
}
elseIf(-not (Test-Path $Filename))
{
"Target .chm file not found, please make sure you're entering the full path and file name"
}
else
{
Start-Process -FilePath $EXE -ArgumentList "-decompile $Destination $Filename"
$FilesAndFolder = Get-ChildItem $Destination -Recurse| group psiscontainer
$FolderCount = ($Filesandfolder| ?{$_.name -eq $true}).count
$FileCount = ($Filesandfolder| ?{$_.name -eq $False}).count
Write-host "Decompiled into $(if($Foldercount -gt 0){$Foldercount}else{0}) Folders and $(if($FileCount){$FileCount}else{0}) Files to Destination $Destination" -ForegroundColor Yellow
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment