Zum Inhalt


Decompile CHM

Sometimes you only have the CHM output file and nobody can locate the source files. It's not always possible to recover all files and data you need.

  • Decompiling loses the alias.h and map.h files and their information for F1-Help (context sensitive help).
  • Any KLink and ALink keywords that were contained in the source html files will be lost.
  • Any Stop words (Full text search stop list file) will be lost.

KLink and ALink keywords are keywords that the help author have embedded in the HTML source of topics, rather than in the hhk file. These keywords are lost because stripped off when the existing old CHM file was compiled.

However, the methods below are well suited for simple structured CHM files and some changes. If you really want to decompile without installing any software, method 5 is the best choice.


Method 1 - Extract with HTMLHelp Workshop

First of all, you need to download and save the HtmlHelp.exe file to your disk.

UPDATE Feb-2021:

The download link https://www.microsoft.com/en-us/download/details.aspx?id=21138 was dropped by Microsoft. You can get files from web archives:

HTMLHelp Workshop - Dropped Download Screen.

Then install the software with the default values. At the end of the installing you may receive the message, that a newer version is already installed.

HTMLHelp Workshop - Ignore and click OK.

You can click OK without worrying if this window is shown.

  1. Launch the Microsoft HTML Help Workshop program
  2. Select File > Decompile from the main menu.
  3. Enter or browse to the folder and file requested.

HTMLHelp Workshop - Decompile.

Method 2 - Extract with FAR HTML

If you have FAR HTML installed, then you have the tools you need. FAR HTML is Freeware now. An installation of the Microsoft HTML Help Workshop is required for FAR HTML anyway.

Decompile CHM using FAR HTML - Create new and empty folder

  1. Open FAR and from the main menu go to Authoring > HH Utilities.
  2. Click File > Open and browse to the CHM file
  3. Click Decompile, select Extract All and browse to the folder to which you want to extract the files (see screenshot above: Create a new folder for this by using the icon in the upper right corner of the dialog).
  4. Click OK when advised the process is complete.
  5. Now you need to create an HHP project file that can be used to compile later. Go to Authoring > Help Express .
  6. In the first field, enter or browse to the folder used in Step 3.
  7. In the second field, enter the Title as it appears in the name of the CHM file you are decompiling.
  8. In the third field, enter the default topic. If you don't know what it is, select any file, you can change it later.
  9. In the fourth field enter the same name as the CHM file you are decompiling and click the Create Help button.

Please note to answer the question after step (9) with No at the next window. The decompiled original files Table of Contents (.hhc) and an optionally existing Index (.hhk) will be overwritten otherwise!

Decompile CHM using FAR HTML - Note: keep the decompiled files.

Method 3 - Extract with KeyTools

KeyTools is a free tool that decompiles the CHM file and creates the HHP file in one process. KeyTools was available from Ralph Walden's site and now ported by us as retired Help MVP's to http://keyworks.helpmvp.com/. If you want to download it from my site you can click here. Some notes on the installation of KeyTools. I am not aware of any incompatibilities up to Microsft's operating system Windows 10.

  1. Open Keytools and select the decompile option.
  2. Enter or browse to the two folders requested.
  3. Click OK.

KeyTools - Application window.

When the process is complete, close Keytools and open Windows Explorer. Browse to the HHP file and compile it e.g. using FAR HTML or Microsoft HTML Help Workshop. You will need to check the generated HHp file, the compiled CHM file and generally make sure the project is as you want it.

Method 4 - Extract with 7zip

7zip can also unzip CHM files. To do this, simply right-click on the file or open e.g. by using a portable version of 7zip from your USD-Stick. Enter or browse to the folder and file requested.

Decompile CHM using 7zip - requested file and destination folder.

Additional files and directories are present here, but they do not represent thematic content. These are internal binary files from the CHM file.

Decompile CHM using 7zip - example of result.

Method 5 - Extract by the man's way

The %SystemRoot%\hh.exe is the viewer for CHM files in Windows and can not only display CHM files but also extract CHM files. No interface - just enter this into a command prompt or PowerShell window and amend as necessary.

hh.exe -decompile <target_directory> <path>\<filename>.chm

Decompile CHM using hh.exe and PowerShell

Please note, it is only possible to use -decompile with folder path and help file name not containing a space character. hh.exe is poor coded regarding to command line argument strings parsing. It supports hh.exe "D:\gxml\test\a b\1.chm" to open a compiled help file with a space in fully qualified help file name. But on using -decompile it interprets the first series of spaces after -decompile always as beginning of the folder path and the second series of spaces after -decompile as beginning of the help file name even on using " around the two argument strings.