# Command-line usage

Below are the basic steps for running **CgiRemoteControl.exe**. Because **CgiRemoteControl.exe** only triggers plugin processing, a separate **<span style="color: rgb(230, 126, 35);">[plugin](https://doc316en.candera.eu/books/cgiremotecontrol/page/plugin-side-implementation)</span>** implementation is required.

### Execution Format

Run **CgiRemoteControl.exe** from a script or command prompt using the following format. See the next section for the runtime **arguments**.

```powershell
CgiRemoteControl.exe --SolutionFilePath "<path>.scs" [--PlugInControl "<command>"] [<configFile>]

```

### Arguments

#### Specifying the Solution Path (Required)

**`--SolutionFilePath <path>`**  
Specifies the path to the `.scs` solution to load (relative or absolute path is acceptable).  
**Example:**

```powershell
--SolutionFilePath "C:/path/test.scs"


```

#### Specifying the Plugin Command (Optional)

**`--PlugInControl "<command>"`**   
Specifies the **plugin command** to execute during processing. If omitted, the plugin’s `OnPluginControl` implementation is **not invoked**.  
**Example:**

```powershell
--PlugInControl "BuildHost 4711"


```

#### Specifying the Configuration File (Optional)

**`<configFile>`**   
Specifies the XML **configuration file name** to use. If omitted, the default **CgiRemoteControlConfig.xml** is used.  
**Example:**

```powershell
C:/path/CgiRemoteControlConfig.xml


```

### Checking Execution Logs

The console prints the selected configuration file name, resolved `SCHostPath`, `SolutionFilePath`, `PlugInControl`, `TimeoutMilliseconds`, and so on. When processing completes, a final message is printed. You can check the process exit code with `echo %ERRORLEVEL%`.

#### Exit Code

Return codes indicate success or failure (0 for success; non‑zero for failure).

<table id="bkmrk-%E3%82%B3%E3%83%BC%E3%83%89-%E6%84%8F%E5%91%B3-0-success--1-" style="width: 50.9524%;"><thead><tr><th align="right" class="align-center" style="background-color: rgb(35, 111, 161); width: 15.8655%;"><span style="color: rgb(255, 255, 255);">Code</span></th><th style="background-color: rgb(35, 111, 161); width: 84.1681%;"><span style="color: rgb(255, 255, 255);">Description</span></th></tr></thead><tbody><tr><td class="align-center" style="width: 15.8655%;">0</td><td style="width: 84.1681%;">Success</td></tr><tr><td class="align-center" style="width: 15.8655%;">-1</td><td style="width: 84.1681%;">Configuration file not found</td></tr><tr><td class="align-center" style="width: 15.8655%;">-2</td><td style="width: 84.1681%;">Permission error accessing the configuration file</td></tr><tr><td class="align-center" style="width: 15.8655%;">-3</td><td style="width: 84.1681%;">Invalid configuration file format</td></tr><tr><td class="align-center" style="width: 15.8655%;">-4</td><td style="width: 84.1681%;">Error loading the solution</td></tr><tr><td class="align-center" style="width: 15.8655%;">-5</td><td style="width: 84.1681%;">SCHost not found </td></tr><tr><td class="align-center" style="width: 15.8655%;">-6</td><td style="width: 84.1681%;">Process timed out</td></tr><tr><td class="align-center" style="width: 15.8655%;">-7</td><td style="width: 84.1681%;">Process cancelled</td></tr><tr><td class="align-center" style="width: 15.8655%;">-8</td><td style="width: 84.1681%;">General error</td></tr></tbody></table>

#### Code Execution Example

```powershell
D:/work/bin/SceneComposer>CgiRemoteControl.exe --SolutionFilePath "C:/path/test.scs" --PlugInControl "BuildHost 4711"
[2025-01-17 10:42:05.954] [Info] Using configuration file: CgiRemoteControlConfig.xml
[2025-01-17 10:42:06.033] [Info] Resolved SCHostPath: C:/path/SCHost.dll
[2025-01-17 10:42:06.033] [Info] Loaded configuration:
[2025-01-17 10:42:06.033] [Info]   SCHostPath: C:/path/SCHost.dll
[2025-01-17 10:42:06.033] [Info]   SolutionFilePath: C:/path/test.scs
[2025-01-17 10:42:06.033] [Info]   PlugInControl: BuildHost 4711
[2025-01-17 10:42:06.033] [Info]   TimeoutMilliseconds: 1800000
[2025-01-17 10:42:06.033] [Info] CgiRemoteControl Process start.
Info: The following licenses were acquired successfully: 2D, 3D, Globalization, SmartImporter, AssetLibraryVerification, Safety.
0000000.574 [0x00009BC0] WARN  Controls      Failed to create source stream object. Possibly no VideoStreamer is registered. {VideoStreamBehavior.cpp(143): VideoStreamBehavior}
Info: Starting schema validation of file:
Info: 1/17/2025 10:42:15 AM:OnSolutionChanged
Warning: The application specification file is missing or invalid!
[2025-01-17 10:42:15.021] [Info] Solution loaded successfully.
Info: 1/17/2025 10:42:15 AM:test log start
Info: 1/17/2025 10:42:15 AM:OnPluginControl BuildHost 4711 Processing...10%
Info: 1/17/2025 10:42:16 AM:OnPluginControl BuildHost 4711 Processing...50%
Info: 1/17/2025 10:42:17 AM:OnPluginControl BuildHost 4711 Processing...100%
Info: 1/17/2025 10:42:17 AM:test log end
[2025-01-17 10:42:17.063] [Info] Plugin executed successfully.
[2025-01-17 10:42:17.063] [Info] CgiRemoteControl Process end.

>echo %ERRORLEVEL%
0



```