The CSE HTML Validator command line processor (cmdlineprocessor.exe) can be run from a command prompt and will accept arguments passed to it from the command line.

NOTE: Since processing more than one file at a time using command line arguments is inefficient (unless you use the -f command), we recommend that you use the drag and drop capability or the Batch Wizard to process multiple files. When using the drag and drop capability, the files to process can be dropped onto the Drag and Drop Window of a running instance of HTML Validator. Use Windows Explorer to select the files to drop, and make sure that HTML Validator is set up to process the dropped files the way that you want (by validating and/or using a tool) using the Drag and Drop Default Tool Select Dialog Box.

The file to run when using command line arguments is called "cmdlineprocessor.exe". This executable understands command line arguments and will call the validator engine (in a DLL) to perform the correct job.

NOTE: Do not enclose the executable name and its arguments in the same quoted string when entering the command in a command prompt or in a task scheduler. Quotes are sometimes used in the documentation to delimit the command line and its arguments from the description, and, in this case, are not meant to be used literally.

Command Summary

IMPORTANT: Specify any options before the primary command (before any -b-f-q, etc; see below for the options).

NOTE: There are additional commands that are used for integration with 3rd party products, but they are not listed here. To see those commands, please visit the developer section on our website.

Command

Description

<filename>

Validate <filename> using the options set in the Classic Page in the Validator Engine Options

-1

Display Validator Engine Options Dialog

-2

Display Configuration Editor Dialog

-3

Display Batch Wizard Options

-4

Display Editor Options

-b

Open the Batch Wizard

-b <filename>

Open the Batch Wizard and process the target list specified by <filename>

-bx <filename>

Open the Batch Wizard and process the target list specified by <filename>, where x specifies the tool to use

-c <filename>

Use the Convert Text File Format Tool on <filename>

-e <filename>

Validate <filename> and output the results; for more information visit the Developer Information Page

-f <filename>

Run the commands in <filename>

-l <filename>

Use the Lowercase Tool on <filename>

-o <filename>

Open <filename> in the editor (can be a URL starting with http:// or https://)

-q

Sends a quit signal to the editor/Batch Wizard

-s <filename>

Use the Remove Tags Tool (Strip Tags Tool) on <filename>

-t <filename>

Use the Template Tool on <filename>

-u <filename

Use the Uppercase Tool on <filename>

-v <filename>

Validate <filename> and open the results in the viewer specified in the Validator Engine Options

-w <URL>

Open <URL> in the integrated editor (automatically prepends http:// if needed)

Option Summary

NOTE: Specify options before the main command (before any -b, -f, -q, etc).

Option

Description

-inifile <filename>

Specify an ini file (filename only or with a full path) to store the configuration in (the filename must exist or the option is ignored). This can be used as a way to use different profiles or "workspaces", or to run multiple instances simultaneously and independently. This feature uses "portable mode" with the specified ini file. (New v11.9914)

-minimize

(New v14.0203) Adds the -minimize option when starting the editor

-msgwindow <name>

(New v11.9914) Specify a custom window name (caption) for the message window. Typically this is never used unless you intentionally want to run more than one instance of CSE HTML Validator at a time. Example: -msgwindow instance1

-outputfile <filename>

Specify the output file, overriding the default

-rx

Change exit code based on value of x

-veofile <filename>

Specify a validator engine options export file to load before the main command

-v0

Suppress the viewer when doing a validation; place before command argument

-xi

XML output override (-x0 - off, -x1 - on) (tick_16Pro, cross_16Std, cross_16Lite)

Primary Commands

IMPORTANT: Specify any options before the primary command (before any -b, -f, -q, etc; see below for the options).

Batch Wizard Commands (tick_16Pro, cross_16Std, cross_16Lite)

"cmdlineprocessor.exe -b" - This (-b with no filename) causes CSE HTML Validator to launch and open the Batch Wizard. If HTML Validator is already running when this command is issued, then the already running instance will open the Batch Wizard and a new instance will not be created. (New v8.00)

"cmdlineprocessor.exe -b <filename>" - This causes the Batch Wizard to validate the targets in the target list specified by filename. The Batch Wizard does not automatically exit after processing. To exit after processing, use the cmdlineprocessor.exe -q command after using the cmdlineprocessor.exe -b command. If HTML Validator is already running when this command is issued, then the already running instance will be used to validate the target list and a new instance will not be created.

"cmdlineprocessor.exe -bx [filename]" - This causes the Batch Wizard to process the targets in the optional target list specified by filename. The tool to process the list with is specified by the x argument after -b (see the possible values for x below).
 
The Batch Wizard does not automatically exit after processing. To exit after processing, use the cmdlineprocessor.exe -q command after using the cmdlineprocessor.exe -bx command.
 
The Batch Wizard, when generating reports, only generates reports in its normal HTML format (XML output is not available).
 
If HTML Validator is already running when this command is issued, then the already running instance will be used to validate the target list and a new instance will not be created. If a filename is not specified, then this command can be used to select the tool to use in the Batch Wizard.
 
Possible values for x (to specify the tool to use) in the expression -bx:

0 - Don't set/change the tool to use - use current tool setting (new v8.04)

1 - Validate (the default)

2 - Uppercase (change tags and attributes to uppercase)

3 - Lowercase (change tags and attributes to lowercase)

4 - Remove tags

5 - Convert (convert file format)

6 - Template (process with the template tool)

7 - Link check (check links only)

8 - Spell check (spell check only)

9 - Quote (quote attribute values)

Tools (tick_16All Editions)

"cmdlineprocessor.exe -l <filename>" - This causes HTML Validator to use the Lowercase Tool on the file specified by filename. Note that -l is the letter L and not the number one.

"cmdlineprocessor.exe -u <filename>" - This causes HTML Validator to use the Uppercase Tool on the file specified by filename.

"cmdlineprocessor.exe -s <filename>" - This causes HTML Validator to use the Remove Tags Tool on the file specified by filename.

"cmdlineprocessor.exe -t <filename>" - This causes HTML Validator to use the Template Tool on the file specified by filename.

"cmdlineprocessor.exe -c <filename>" - This causes HTML Validator to use the Convert Text File Format Tool on the file specified by filename. The format converted to is specified by the last saved program options.

Display Dialogs

"cmdlineprocessor.exe -1" - (tick_16All Editions) This causes the Validator Engine Options to be displayed. HTML Validator exits (does not continue running) when the Validator Engine Options are closed.

"cmdlineprocessor.exe -2" - (tick_16Pro, cross_16Std, cross_16Lite) This causes the Configuration Editor to be displayed. HTML Validator exits (does not continue running) when the Configuration Editor is closed.

"cmdlineprocessor.exe -3" - (tick_16Pro, cross_16Std, cross_16Lite) This causes the Batch Wizard Options to be displayed. HTML Validator will remain running when the Batch Wizard Options are closed.

"cmdlineprocessor.exe -4" - (tick_16All Editions) This causes the Editor Options to be displayed. HTML Validator will remain running when the Editor Options are closed.

Executing Multiple Command Lines Efficiently with -f

"cmdlineprocessor.exe -f <filename>" - (tick_16Pro, tick_16Std, tick_16Lite) This causes one instance of HTML Validator to efficiently execute multiple command lines. Using the -f method instead of calling cmdlineprocessor.exe once for each command may be much faster, depending on the specific commands.
 
Each command line is specified on a single line in the text file specified by filename except that cmdlineprocessor.exe is unnecessary and should not be used.
 
Comments are allowed in filename. If the first two non-space characters of a line are "//" (without the quotes), then the line is treated as a comment and is ignored.
 
Example: Assume there are many documents that you want to use the template tool on (-t). Create a file called templatetool.txt that contains the following:
 
-t c:\htmlfiles\document1.html
-t "c:\htmlfiles\dir with space\document2.html"
-t c:\htmlfiles\document3.html
-t c:\htmlfiles\document4.html
 
Now process all the commands in templatetool.txt by calling cmdlineprocessor.exe -f templatetool.txt. The full path to cmdlineprocessor.exe and/or templatetool.txt may need to be used. Note that commands may also be mixed. The below would also be acceptable for templatetool.txt, although you may want to change the name of the file to a more general name like csecommands.txt:
 
// -if the first two non-space characters are "//", then the line is ignored
-v c:\htmlfiles\document1.html
// be sure to enclose the filename in double quotes if it contains any spaces
-t "c:\htmlfiles\dir with space\document2.html"
-l c:\htmlfiles\document3.html
-t c:\htmlfiles\document4.html
// the below line validates the file without the "-v" option (-v forces the viewer to open)
c:\htmlfiles\document5.html
// the below line causes the Batch Wizard to process the specified target list
-b c:\htmlfiles\batchwizard.lst

Other Primary Commands

"cmdlineprocessor.exe -n windowname,messagenum,messageint" - (tick_16All Editions) This causes HTML Validator to send the message WM_USER+messagenum to the window named windowname. LPARAM will be messageint.

"cmdlineprocessor.exe <filename>" - (tick_16All Editions) This causes HTML Validator to validate the document specified by filename. HTML Validator may ask you if you want to open the viewer application with the results or may automatically open the viewer, depending on the options set in the Classic Page in the Validator Engine Options. The -rx option can be used with this command to return the number of error messages or error+warning messages (see below). NOTE: Use the -o option to open a file in the integrated editor.

"cmdlineprocessor.exe -v <filename>" - (tick_16All Editions) This causes HTML Validator to validate the file specified by filename. -v forces the HTML Validator to open the results with the viewer, regardless of the options set in the Classic Page in the Validator Engine Options. The -rx option can be used with this command to return the number of error messages or error+warning messages (see below). NOTE: Use the -o option to open a file in the integrated editor.

"cmdlineprocessor.exe -o <filename>" - (tick_16All Editions) This causes HTML Validator to open the file specified by filename in the integrated editor. Filenames may be enclosed by quotation marks and should be if the filename contains space characters.

"cmdlineprocessor.exe -q" - (tick_16All Editions) If HTML Validator's editor is running, then this command sends a quit signal that causes it to exit. NOTE: Unsaved changes to documents, the configuration file, and the Batch Wizard target list will be lost if HTML Validator is closed in this manner. If the Batch Wizard is processing a target list, then HTML Validator will attempt to exit after the processing is completed and the job is done. cmdlineprocessor.exe will return (exit) and the command will complete when HTML Validator's editor exits and is no longer running in the system. In v10.00 and later, if no instance of the editor is found, then this command will wait up to 10 seconds looking for an instance to send the quit signal to (this solves some possible timing issues).

"cmdlineprocessor.exe -w <URL>" - (tick_16All Editions) This causes HTML Validator to open the URL specified by <URL> in the integrated editor using 'Open from the Web'. If the URL does not start with "http://" or "https://" then "http://" is automatically prepended. (New v14.00)

NOTE: The program options and configuration used to validate a document using a command line are those that are last saved and not necessarily those that are currently active if an instance of HTML Validator is running. This includes validating a document using an HTML editor that provides integrated support for HTML Validator. If you've made changes to the options or configuration, then make sure that these changes have been saved before calling the validator on a command line.

Command Line Options

IMPORTANT: Specify these options before the primary command (before any -b, -f, -q, etc).

Output File (-outputfile)

The -outputfile <filename> option (new in v9.00) can be used to specify the output file, overriding the default. Use this option only when doing a validation (but not with a Batch Wizard command).

Validator Engine Options (-veofile)

The -veofile <filename> option (new in v9.00) can be used to specify a validator engine options export file (VEO file) that is loaded before the main command. This allows commands to be performed using different sets of validator options.

NOTE: This option can now be used with -b, -q, or by itself. When used in one of these ways, it causes the default validation settings to be changed for all future validations. It works as if a user opened the editor then went to the Validator Engine Options, imported a VEO file and then saved the options/settings. (New v15.03)

Viewer Override (-v0)

The -v0 option (new in v9.00) can be used to suppress the viewer. Use this option only when doing a validation (but not with a Batch Wizard command).

XML Output Override (-xi) (tick_16Pro, cross_16Std, cross_16Lite)

The -xi option (new in v8.00), where i is a number, can be used to override the default setting for generating XML output files that contain the results of the validation. Use this option only when doing a validation (but not with a Batch Wizard command). For more information, see the XML Output option in the Validator Engine Options. The following -xi options are allowed:

-x0 - Do not generate an XML output file

-x1 - Generate an XML output file

NOTE: Do not use -x by itself (without a number) as this command is reserved for a special purpose.

Exit Codes/Return Values

When cmdlineprocessor.exe exits, it returns one of the following exit codes:

0 - no errors occurred in the cmdlineprocessor.exe portion of the command; however, it is possible an error occurred later

1 - a filename was given on the command line but the file does not exist

2 - miscellaneous error

3 - a filename is required for the command but none was given

4 - a timeout occurred waiting for HTML Validator's message window to become available; message could not be sent

NOTE: Versions prior to v4.0330 will always return 0 as the exit code.

The -rx option (new in v8.00), where x is a number, can be used to change the exit code so that it is based on the number of errors and warnings found in a document.  This allows you to take different actions based on the results of a validation. Use this option only when doing a validation (but not with a Batch Wizard command). To use this option, make sure that it is used before the main command option. For example, to return the number of errors in test.html, use "cmdlineprocessor.exe -r1 test.html" or "cmdlineprocessor.exe -r1 -v test.html". The following -rx options are allowed:

-r0 - normal behavior (returns the default/normal exit code)

-r1 - return the number of validator error messages

-r2 - return the number of validator error messages plus the number of warning messages

NOTE: If the default exit codes are overridden with -rx and an error occurs, then the negative of the default exit code will be returned. For example, if -r1 or -r2 is used and a bad filename is given, then -1 will be returned.

NOTE: If the exit code would be 259 (STILL_ACTIVE) then the exit code is automatically reduced by 1 to 258. This is to prevent problems with applications that test the exit code for STILL_ACTIVE. This prevents the application from thinking that cmdlineprocessor.exe is still active when it really isn't, and from possibly getting into an infinite loop. (New v8.00)

Special Notes

If you are executing cmdlineprocessor.exe from a command prompt, then you must include the path to cmdlineprocessor.exe if the folder that contains cmdlineprocessor.exe is not in the search path, otherwise the system will not be able to find cmdlineprocessor.exe. However, you can type the command in the Start | Run dialog box without a path to the executable (in this case, use htmlval.exe instead of cmdlineprocessor.exe; the system will automatically translate htmlval.exe to the correct executable).

If you are executing HTML Validator's editor from a command prompt, then you must include the path to cse160.exe if the folder that contains cse160.exe is not in the search path, otherwise the system will not be able to find the editor. However, you can type the command in the Start | Run dialog box without a path to the executable.

When cmdlineprocessor.exe is run with command line arguments, cmdlineprocessor.exe performs the operation specified by the command line arguments and then immediately exits (unless otherwise noted above for the specific argument).

Be sure to include the full path to filename if it is not in the current folder.

Letters following '-' are not case-sensitive. They may be either uppercase or lowercase such as -l or -L.

When validating a file with cmdlineprocessor.exe, holding down the shift key will cause the page source to be opened in the viewer without validating it. This does not apply when -f is used and only works if the option to enable this functionality is checked in the Validator Engine Options (it is enabled by default).

Link checking can only be done when using the -bx commands for the Batch Wizard.

Use (prepend) "cmd /C" to call cmdlineprocessor.exe when you want to wait until it's finished (perhaps in a batch script) before the command returns.

Do not enclose the executable name and its arguments in the same quoted string when entering the command in a command prompt or in a task scheduler. Quotes are sometimes used in the documentation to delimit the command line and its arguments from the description, and, in this case, are not meant to be used literally.

Opening Files in the Editor

The preferred way to open a file in the editor is to use cmdlineprocessor.exe with the -o option. Another method would be to call cse160.exe followed by the filename. For example, cse160.exe <filename>.