# LaunchProcess

LaunchProcess starts a program on the server machine for files of an event: a copy command, a script, an application of your own.

It is the older way. In version 27 an [Execute task](Task-Execute.md) in a job does the same, with the output of the program on record: use that for anything new.

> [!NOTE]
> A server of version 27 built from the current sources comes with eleven plugins, and this one is not among them. Preferences still has its screen, which shows when the plugin's file is in the server's `plugins` folder, as it can be on a server that was upgraded from an earlier version, and where files that are not the server's own may be loaded: see [Writing a plugin](Plugins-Writing-Your-Own.md#getting-it-loaded). This page is written from that screen and the plugin's own help text; the plugin was not run.

## Settings

| Setting | Is |
|---|---|
| **Enabled**, **Debug** | as for every plugin. With **Debug** on, the log shows the command as it would be run. |
| **Command** | the program to start: `cp`, `/opt/tools/scan.sh` |
| **Examples** | fills **Command** with a sample: **Copy to archive folder** (`cp`), **Move to hidden directory** (`mv`), **Run your own app giving..**, **Open the file (dangerous)** (`open`) |
| **Argument** | what the program is given. Variables of the file stand for its values: `%the_real_path%` is the file on the disk, `%the_file_name%` its name. |
| **Separator** | the character that separates the arguments in **Argument** |
| **Only use most recent item.** | for an event that runs at once, only the file that caused it is handled. Without it, the command is run for each file of the event. |
| **Run command once with argument repeated for each item.** | one start of the program for all files: `command argument argument argument` |

The plugin's own example: with the command `cp` and the argument `%the_real_path%:/archive/%the_file_name%`, where `:` is the separator, a file uploaded as `/upload/stuff.zip` is copied to `/archive/stuff.zip`.

## Using it

The plugin does nothing by itself. An [event](Users-Events-Editor.md) of a user runs it: action **Run Plugin**, plugin **LaunchProcess**.

## Things to know

- **The program runs as the server**, with the rights of the account the server runs under. Give it only commands you wrote or checked.
- **File names come from users.** A command line built from a name can be bent by a name with spaces or special characters. The Execute task passes each argument separately, which is safer.
