Execute command
Executes the command on the server
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
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 = "Jg9F...";
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 \
--url "93.125.42.204:25575" \
--pass "***" \
--wtout 20 \
--rtout 20 \
--exec "list" \
--conn "{'url':'93.125.42.204:25575','password':'***','read_timeout':20,'write_timeout':20}"
:: JSON data can also be passed as a path to a .json file
oint rcon ExecuteCommand ^
--url "93.125.42.204:25575" ^
--pass "***" ^
--wtout 20 ^
--rtout 20 ^
--exec "list" ^
--conn "{'url':'93.125.42.204:25575','password':'***','read_timeout':20,'write_timeout':20}"
Result
{
"data": "There are 0/20 players online:",
"result": true
}