Documentation for Axxon PSIM 2.0. Documentation for other versions of Axxon PSIM is available too.

Previous page Next page


The run_cmd method is used to execute commands on the command line from a script.

The run_cmd_timeout method is used to execute commands on the command line with the specified process termination timeout.

When you call commands, the command line window doesn't open; commands are executed in hidden mode.

Syntax for method invocation:

function run_cmd (cmd: String)
function run_cmd_timeout (cmd: String, timeout: int)

Method arguments:

  1. cmd is a command for the command line.
  2. timeout (only for run_cmd_timeout) is a command line process termination timeout after the command execution.

Example 1. Run the curl utility and send the POST request with the text "Hello" to the test URL https://postman-echo.com/post

var s = run_cmd("curl --request POST --url https://postman-echo.com/post --data \'Hello\'");
DebugLogString(s);

Example 2. Display results of the SQL request.

if (Event.SourceType == "MACRO" && Event.Action == "RUN" && Event.SourceId == "1")
{ 
   var s = run_cmd("sqlcmd -S MUKHAMED\\SQLEXPRESS2022 -U sa -P PSIM_default_DB_4 -d PSIM -Q \"SELECT id FROM dbo.OBJ_GRABBER WHERE parent_id='MUKHAMED'\" -o C:\\Users\\AxxonSoft\\Desktop\\result.txt");
}

  • No labels