Go to documentation repository
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:
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");
}