# Rainbow ## Command Line

If you are using an Okapi Tool after the M9 release, you should be using the wiki online help:
http://www.opentag.com/okapi/wiki/index.php?title=Rainbow

When starting Rainbow has different behaviors depending on the arguments on its command-line:

- If Rainbow is started with just one argument: it starts in normal mode and takes the argument as a project file to be loaded.
- If Rainbow is started with more than one argument: it starts in command-line mode and interprets the arguments as described in the table below.

The arguments of the command-line can be the following:

`-p <projectFilename>` | Loads an existing project file `<projectFilename>`.
`-x <utilityId>` | Executes the utility with the ID `<utilityId>`. This is done after all arguments of the command line have been processed.
`-pln <pipelineFilename>` | Loads and execute the specified pipeline stored in `<pipelineFilename>`.
`-se <encoding>` | Sets the default source encoding to `<encoding>`.
`-te <encoding>` | Sets the default target encoding to `<encoding>`.
`-sl <langCode>` | Sets the source language using `<langCode>`.
`-tl <langCode>` | Sets the target language using `<langCode>`.
`-opt <optionFilename>` | Sets the options file to use for the utility to execute. Use the `-np` flag to be prompted or not to modify the options when the command line is executed. The options file must be for the utility defined with `-x`.
`-np` | No prompt for utility's options.
`<inputFile>[ -fc <filterConfiguration>]` | Sets the input file, and optionally sets the filter configuration to assign to it. You can specify an absolute or a local filename. The input file root is reset to the folder of the given input file. If a project was loaded, all input files in that projects are removed and the input file root reset. If you specify several input files (and their filter configurations) the first one will be assigned to the input list 1, the second to the input list 2, etc. If the filter configuration is no specified in the command line, the default filter (if one can be found) is used.
`-o <outputFile>` | Sets the output file. If this option is not used and an input file is specified, the output file path and name is build based on the output options of the project (loaded or default).
`-pd <directory>` | Sets the parameters directory (the location where the filter parameters files are stored). You can use `.` (dot) to specify the current directory. By default, if not project is loaded, the default parameters directory is the user home directory. When the `-pd` option is set it is also utilized as the root directory to substitute for the `${{rootDir}` variable that can be used in some path parameters.
`-?` or `-h` | Opens this help page.

Here are some example of command lines in Windows. They assume Rainbow is installed in `C:\rnb` directory.

    C:\>java -jar \rnb\lib\rainbow.jar -x oku_textrewriting -sl EN -tl FR -opt myOptions.opt myInput.xlf -o myOutput.xlf -np

The command-line above executes the Text Rewriting utility with the source language set to `EN` and the target language set to `FR`. The input document is the XLIFF file `myInput.xlf`, and the modified file is saved as `myOutput.xlf`. The utility will use whatever options are set in the options file named `myOptions.opt`. If that file does not exist, one will be created with the default options for the Text Rewriting utility. In both cases the user will not be prompted to change the options (`-np` parameter).

    C:\>java -jar \rnb\lib\rainbow.jar -x oku_transcomparison -sl EN -tl FR -pd . myHumanTrans.xlf myMachineTrans.txt -fc okf_regex@myText

The command-line above executes the Translation Comparison utility with the source language set to `EN` and the target language set to `FR`. The current folder (`.`) is specified as the parameters directory. The input file `myHumanTrans.xlf` is the input document for the Input List 1, and the default XLIFF filter assigned to it. The input file `myMachineTrans.txt` is the input document for the Input List 2, and the custom filter parameters `okf_regex@myText.fprm` is associated with it. No utility options are specified, so the use will be prompted to set the options.

    C:\>java -jar \rnb\lib\rainbow -h

The command-line above opens this help page.