Show Sitemap ..Help2HTMLHelpWinHelp

HTMLHelp command-line

HH.EXE is distributed with HTML Help so you can rely on it being present. It lives in the Windows folder and has a limited number of command-line options. HH.EXE is associated with .CHM files. So double-click a *.CHM file and Windows will open the file using HH.EXE. Its a very small file, it mostly passes the help filename onto a HH API library. HH.EXE is not single instance, if you open a CHM file three times using HH.EXE, then three help windows will appear.

Batch file

Call from batch command file:

hh.exe mk:@MSITStore:C:\_temp\linking_example.chm::/Topic_Folder_1/KIT_title.htm

To suppress the DOS windows, the call can be carried out with the parameter /B.

start /B hh.exe mk:@MSITStore:C:\_temp\linking_example.chm::/Topic_Folder_1/KIT_title.htm

Weitere Informationen:
1. Microsoft information
2. Simon Sheppard's website - Start a specified program or command in a separate window.


Example of opening a help topic using help ID = 12030

ID is a number that you've defined in the [MAP] section of your project (*.hhp) file and mapped to the required topic in the [ALIAS] section.
Note: The "-map ID chm" command line became available in HH 1.1b.

C:\>HH.EXE -mapid 12030 ms-its:C:/xTemp/XMLconvert.chm

 

Example of opening a help topic using a topic path

C:\>HH.EXE ms-its:C:/xTemp/XMLconvert.chm::/Bekannte_Fehler/err/xml3.htm
C:\>HH.EXE mk:@MSITStore:C:/xTemp/XMLconvert.chm::/Bekannte_Fehler/errxml3.htm

C:\>HH.EXE ms-its:C:/xTemp/XMLconvert.chm::/Bekannte_Fehler/err/xml3.htm#anchor

The mk:@MSITStore protocol works with IE3 and above while ms-its works with IE4 and above. A shorter version of "ms-its" is to just use "its". Actually, the later versions of HH don't even require the protocol prefix.

You can omit the path to the *.CHM file, if it is in the %\Windows\Help directory or registered under the following key in the Windows registry:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\HTML Help

To remember MS-DOS commands try:

c:\>hh.exe ms-its:\Help\ntcmds.chm::/ntcmds.htm

Example of using HH.EXE to decompile a CHM help file

Command line from a DOS window:

C:\>HH.EXE -decompile D:/xTemp/decompile-folder C:/xTemp/XMLconvert.chm

Call from batch command file:

HH.EXE -decompile D:/xTemp/decompile-folder C:/xTemp/XMLconvert.chm

HH.EXE -decompile decompile-folder file.chm
where "decompile-folder" is the directory to put the files into. This could be simply "."

Decompiling the file produces a slew of HTML and image files, together with the table of contents (.hhc) file, index (.hhk) file, and a few other supporting files.

The only decompiler with any additional features is KeyTools (see below), as this can try to rebuild the project (.hhp) file. You will need this file if you want to recompile the help project.

One thing to note is that the decompile/recompile process isn't a "round-trip" process. Certain features that the help author added to the original help file can't be recovered when you decompile it, so these may no longer work properly after you've recompiled. This is especially true in the area of context-sensitive help, which may be broken in the new version of the file.

How to decompile using KeyTools

Compiling HTMLHelp from the command line

The required command is:

hhc foobar.hhp

You must specify the relative or absolute path to the .hhp file if compiling from a folder other than the one that contains this file. And you'll need to ensure that the HTML Help Workshop program folder is in the path, as that's where hhc.exe resides.

  1. Close all instances of the HTMLHelp Workshop
  2. Click on the Start menu, choose Run and type cmd
  3. Type e.g.
"%programfiles%\HTML Help Workshop\hhc" d:\_temp\CHM-example.hhp
or
"%programfiles%\HTML Help Workshop\hhc" d:\_temp\CHM-example.hhp > log.txt

This command assumes that you have installed HTMLHelp Workshop to the default path, so you will have to modify this command line if you installed to a non-default path.

On 32bit Windows, %ProgramFiles% is your friend.

On 64bit Windows, things are a little more complicated, as application can be installed both in %ProgramFiles% and %ProgramFiles(x86)%.

VBA (Excel) example
Sub HTMLHelp_Compile()
'// call HTMLHelp file (CHM) compiler from Excel (VBA)

Shell """C:\Program Files\HTML Help Workshop\hhc.exe""" & _
" C:\Users\Ulli\_temp\CHM-example.hhp", vbNormalFocus

End Sub

Note:

KeyHH.EXE is a free program from KeyWorks Software, written by Ralph Walden. KeyHH.EXE supports many more command line options then HH.EXE. I have to say that KeyHH.EXE is an excellent program.

You can get more information about KeyHH.EXE from the KeyWorks web site at http://keyworks.helpmvp.com/.


Top ...