Converting from HTM to TXT

If you have trouble running these examples, see Using the Command Line and Helpful Hints For Creating a Command Line

The examples below show conversions from HTM to TXT (8 bit ASCII) using the Convert Doc conversion method, which does not require MS Word and is very fast. Alternatively, you can use the MS Word conversion method. To use the MS Word conversion method in the examples below:

1. Replace the /M2 switch with /M1 (this switch specifies which conversion method to use).

2. Remove the /F4 switch (Word will detect the input file type).

3. Replace /C1, which specifies the output file type, with one of the following:

a.    /C2 (text)

b.    /C3 (text with line breaks)

c.    /C4 (DOS text)

d.    /C5 (DOS text with line breaks)

e.    /C7 (Unicode text).

 

Converting a Single File

To convert a single file (for example: D:\MyFolder\Doc1.HTM to C:\Results Folder\Doc1.TXT), use the following syntax:

 

ConvertDoc /S "D:\MyFolder\Doc1.HTM" /T "C:\Results Folder\Doc1.TXT" /F4 /C1 /M2 /V

 

The /S and /T switches above specify Source (input) and Target (output) path respectively and are both required when converting a single file. Use double quotes around the path especially if there are space characters within the path.

The /M2 switch tells Convert Doc to use the Convert Doc method (it is one of the three possible conversion methods).

/F4 is the input file type, which in this case is a HTML file. The File Type Constants Specification for the Convert Doc method shows that the numeric value of 4 corresponds to a HTM file.

/C1 is the output file type, which in this case is a TXT file. The File Type Constants Specification for the Convert Doc method shows that the numeric value of 1 corresponds to a TXT file.

NOTE: To convert to Unicode text use /C6 instead of /C1. This applies to all the examples in this section.

The /V (for Verbose) switch is used to give instant feedback by having the program report the status of the conversion with a message box. You can remove this once you have perfected your command line specification. You can also (or instead of /V) create a Log file that will contain the results of the conversion by using the /L switch.

Note: Use the Verbose (/V) switch initially to see what the status of your conversion is and to help you perfect your command line. In verbose mode, CD displays messages to indicate what went wrong or right with your command line.

Converting a Whole Folder

To convert all the HTM files in the D:\ToDo\ folder to TXT files in the same directory, use the following syntax:

 

ConvertDoc /S"D:\ToDo\*.HTM" /T "D:\ToDo\*.TXT" /F4 /C1 /M2 /V

 

The /G switch can be used to tell Convert Doc to  place each output file in the same folder as each input file.

The command line above is equivalent to the command line below:

 

ConvertDoc /S "D:\ToDo\*.HTM" /G /F4 /C1 /M2 /V

 

Converting a Whole Folder and all Sub-Folders

To extend the previous example (immediately above) to convert all sub folders within D:\ToDo\,  add the /R switch.

 

ConvertDoc /S "D:\ToDo\*.HTM" /G /F4 /C1 /M2 /V /R

 

To convert a whole folder and its sub folders and place the output into a separate folder/drive,use this syntax:

ConvertDoc /S"D:\ToDo\*.HTM" /T "C:\Done\*.TXT" /F4 /C1 /M2 /V /R