# CLI

The **CLI / Ad-Hoc Script Editor** has two main functions:

* It provides a very simple command line interface (CLI) to the Directory Opus command set.
* In Script mode, it allows you to design and test ad-hoc [scripts](../scripting).

You can open the CLI using the **Tools / Opus CLI** menu command.

![](https://3597805814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3XSZSwWow0fDf6fQJobd%2Fuploads%2Fgit-blob-0a1474817b5eba62e1a13a911d92cf8491917b3e%2Fcli.png?alt=media)

The command line lets you run [internal commands](../reference/command_reference/internal_commands) directly without having to configure a button or hotkey first. It is similar to using the [find-as-you-type](../basic_concepts/the_lister/find-as-you-type_field) field in command mode. You can also display the full template for any internal command by entering the command name followed by a ? symbol (as in the screenshot above).

Turning on the **Script interpreter** option puts the CLI in Script mode, which allows you to design and test ad-hoc scripts. The drop-down field lets you select the script language - if the language you wish to use isn't listed, simply type the name in. You will need to consult the documentation for third-party languages as to the name of the "script engine".

![](https://3597805814-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3XSZSwWow0fDf6fQJobd%2Fuploads%2Fgit-blob-cecb12c8ef305d98c9cfe396252163405f40d380%2Fcli_scriptmode.png?alt=media)

Press **F5** or click the **Run** button to run your script. Any errors, warnings or text output from the script (e.g. via the **DOpus.Output** method) will be displayed in output field below the editor.

(Accelerator keys mentioned below are for the English version of Directory Opus. Hover the mouse over buttons to discover their accelerators in your language.)

The **Abort** (**Alt+A**) button can be used to stop a script which is caught in a loop.

The **New** (**Alt+N**) button clears both the script and output field so you can start afresh.

The **Load** (**Alt+L**) and **Save** (**Alt+S**) buttons allow you to load and save scripts for use at a later date.

If the **Clear** option is checked, the output field will be cleared each time a script is run; otherwise, output from each run will accumulate.
