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), it is recommended 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.
Primary Commands
Batch Wizard (
Pro,
Std,
Lite)
| • | "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. 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 (
Pro,
Std,
Lite)
| • | "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" - ( |
| • | "cmdlineprocessor.exe -2" - ( |
| • | "cmdlineprocessor.exe -3" - ( |
| • | "cmdlineprocessor.exe -4" - ( |
Other
| • | "cmdlineprocessor.exe -f <filename>" - ( 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 |
| • | "cmdlineprocessor.exe -n windowname,messagenum,messageint" - ( |
| • | "cmdlineprocessor.exe <filename>" - ( |
| • | "cmdlineprocessor.exe -v <filename>" - ( |
| • | "cmdlineprocessor.exe -o <filename>" - ( |
| • | "cmdlineprocessor.exe -q" - ( |
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
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). To use this option, make sure that it is used before the main command option.
Validator Engine Options (-veofile)
The -veofile <filename> option (new in v9.00) can be used to specify a validator engine options export file that is loaded before the main command. This allows commands to be performed using different sets of validator options. To use this option, make sure that it is used before the main command option.
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). To use this option, make sure that it is used before the main command option.
XML Output Override (-xi) (
Pro,
Std,
Lite)
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). To use this option, make sure that it is used before the main command option. For more information, see the XML Output option. 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 cse90.exe if the folder that contains cse90.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). |
| • | 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 cse90.exe followed by the filename. For example, cse90.exe <filename>.