Get help for Windows built-in command-line tools with PowerShell

26709891580_b8657b36d2_m
One of the reasons I like PowerShell is its built-in help system (here is a nice post in case you don’t know how to use PowerShell’s built-in help). E.g.:

Get-Help Get-Command
Get-Help Get-Command -Examples
Get-Help Get-Command -Parameter Name

In fact, once you get comfortable using PowerShell help aka Get-Help, you start missing similar built-in documentation for other tools/scripting languages. Wouldn’t it be nice if one could use Get-He.lp for Windows command-line tools?:

Get-Help chkdsk
Get-Help chkdsk -Examples
Get-Help chkdsk -Paramater c

GetLegacyHelp
Say ‘Hello’ to Get-LegacyHelp! With Get-LegacyHelp you can retrieve help for built-in windows command line tools in a similar way as Get-Help works against PowerShell cmdlets.
How does it work? Importing the module (Get-LegacyHelp.psm1) and running Get-LegacyHelp (alias glh) the first time will perform the following steps:

  • Download the Windows command line reference help file WinCmdRef.chm
  • Download and extract the HTML Agility pack dll
  • Decomple the .chm into separate .html files using hh.exe
  • Rename the html files and extract the information (using HTML Agility Pack) into PSObject format
  • Export the entire object to disk using Export-CliXml

Afterwards (and for any subsequent invocation):

  • The XML is imported…
  • Relevant information filtered..
  • and the data is displayed in a similar format to the Get-Help output

Get-LegacyHelp supports the -Parameter, -Full, and -Examples parameters:
GetLegacyHelpExamples

GetLegacyHelpParameter

The Module can be downloaded from my GitHub repository. It’s not perfect since the information is not consistently structured throughout the .chm file. If you want to improve it, please feel free to fork and share.

shareThoughts


Photo Credit: Bruno Zaffoni via Compfight cc

Advertisements

I'd love to hear what you think

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s