Execute command
Executes the command on the server
- Parameters
- Advanced call ?
Function ExecuteCommand(Val Command, Val Connection) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Command | --exec | String | ✔ | Command text |
| Connection | --conn | Arbitrary, Structure Of KeyAndValue | ✔ | Connection or connection parameters |
Returns
Map Of KeyAndValue - Result of command execution
| Parameter | Description |
|---|---|
| addin_mode | Manual selection of external component connection mode (for 1C): Isolated, NotIsolated |
| dontwait | Creates a background job and returns its data (for 1C and OneScript only) |
tip
When passing connection parameters, a new connection will be created and closed within the execution of a single command. To execute several commands (in OS and 1C versions), it is recommended to use a connection created in advance (see CreateConnection)
1C:Enterprise/OneScript code example
URL = "127.0.0.1:25565";
Password = "12We...";
WriteTimeout = 20;
ReadTimeout = 20;
ConnectionParams = OPI_RCON.FormConnectionParameters(URL, Password, ReadTimeout, WriteTimeout);
Connection = OPI_RCON.CreateConnection(ConnectionParams);
Command = "list";
Result = OPI_RCON.ExecuteCommand(Command, Connection);
- Bash
- CMD/Bat
# JSON data can also be passed as a path to a .json file
oint rcon ExecuteCommand \
--exec "list" \
--conn "{'password':'***','read_timeout':'20','url':'127.0.0.1:25575','write_timeout':'20'}"
:: JSON data can also be passed as a path to a .json file
oint rcon ExecuteCommand ^
--exec "list" ^
--conn "{'password':'***','read_timeout':'20','url':'127.0.0.1:25575','write_timeout':'20'}"
Result
{
"data": "There are 0 of a max of 20 players online: ",
"result": true
}