Invantive Query Tool can be started with options on the command line. They are meant for automation, for support and for making reproducible screen captures; they do not replace the [[Invantive Query Tool/Log on|log on window]].
An option is written as `/name` or `/name=value`. The forms `-name` and `--name` are accepted as well, and a colon may be used instead of the equals sign, so a script written for another shell or for another Invantive product keeps working. A value holding spaces is put between double quotes. Options are not case sensitive and may be given in any order; an argument which is no option of the product is ignored.
## Asking for the Usage
```
Invantive.Producer.QueryTool.exe /help
```
The usage is written to the console of the shell that started the program. Invantive Query Tool is a windows application and has no console of its own, so it attaches to the one of the shell; when it is started without a shell, for instance from the Start menu, the usage is shown in a window instead. The program ends directly afterwards.
`/?` and `/h` do the same, as do `-h` and `--help`.
The usage lists exactly the options below: it is composed from the same declarations with which the product reads its command line, so the two can not drift apart. Every Invantive program answers `/help` in this way and in the same notation, from release 27.0 onward.
## Marking a Special Run
A run which is not a person going about their work can be marked, so the title bar of every window shows it:
```
Invantive.Producer.QueryTool.exe /signal="AI STARTED"
```
This is the same marker as the environment variable `INVANTIVE_RUN_SIGNAL`, which every Invantive product on this framework honours; see [[Run Signal]] for what it does, which products carry it, and how a window without a title bar shows it.
## Executing Statements
Statements can be handed over on the command line. They are put in a document of their own and executed once a connection has been made; logging on is not bypassed.
```
Invantive.Producer.QueryTool.exe "/execute=select 1 as x"
Invantive.Producer.QueryTool.exe "/script=C:\temp\report.sql" /exitafterexecute
```
- `/execute=<statements>`: the statements to execute.
- `/script=<file>`: a file holding the statements to execute.
- `/exitafterexecute`: close the application once they have run, which makes the product usable from a batch file.
Note the quotes around the whole option, name included. A shell splits an unquoted value on its spaces, which would hand over only the first word.
## Opening Documents
The documents to work on can be named on the command line. The option may be repeated, in which case the documents appear in the order given and the last one named is the one in front:
```
Invantive.Producer.QueryTool.exe "/open=C:\sql\daily.sql" "/open=C:\sql\month.sql"
```
A file which does not exist yet still becomes a document, empty and carrying that name, so the statements written in it can be saved under it straight away. A file which cannot be read is skipped, so one unreadable file does not keep the others closed.
Naming documents leaves the documents of the previous session alone, exactly as `/nodocuments` does below: the run states which documents it wants, so the stored ones are neither opened nor written back. Available from release 27.0.
## Leaving the Documents of the Previous Session Alone
Invantive Query Tool opens the documents of the previous session again at start and writes them back at exit. A run which is not a person going about their work - a test, a screen capture, a reproduction for support - is to do neither:
```
Invantive.Producer.QueryTool.exe /nodocuments
```
The run then starts with one empty document, and the documents of the previous session are neither opened nor written back. Both halves matter: the statements of a user are personal data and may hold the data of their customers, so a capture or a log of such a run would disclose them, and a run which writes its own documents back replaces what the user had without leaving a trace. Available from release 27.0.
## See Also
- [[Invantive Query Tool/Installation|Installation]]
- [[Invantive Query Tool/Log on|Log on]]
- [[Invantive Query Tool/Main Window|Main Window]]