Run Windows Script
Verb: runWindowsScript
Runs VB, JS, BAT or WScript scripts via text, file or asset.
Syntax
runWindowsScript [--scripttype(WindowsScriptType)] [--source(WindowsScriptSource)] --script(String) --file(String) --asset(String) [--arguments(String)] [--blockexecution(Boolean)] (Numeric)=exitcode (String)=output (String)=error
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--scripttype | Script Type | Optional | WindowsScriptType | Types of script to run:
|
--source | Source | Optional | WindowsScriptSource | Options for the source code of the script that should be executed:
|
--script | Code | Only whenSource is Text | Text | Source code of the script. |
--file | File | Only whenSource is File | Text | Path to the file containing the script. |
--asset | Asset | Only whenSource is Asset | Text | Name or variable of the asset that contains the script file. |
--arguments | Parameters | Optional | Text | Parameters with values passed to the script. |
--blockexecution | Block Execution | Optional | Boolean | When enabled, it blocks the execution of the current script until the Windows script ends. |
Outputs
Script | Designer | AcceptedTypes | Description |
---|---|---|---|
exitcode | Exit Code | Number | Exit code of the script execution.
Only returns a value if the option Block Execution is enabled. |
output | Output | Text | Output from the execution of the informed script.
Only returns a value if the option Block Execution is enabled. |
error | Error | Text | Error returned if script execution fails.
Only return a value if the option Block Execution is enabled. |
Example
The command executes a "taskkill" to end the Notepad application process, previously started by the command Launch or Attach Window.
defVar --name padWindow --type Window
launchOrAttach --executablepath "notepad.exe" --useregex --regexPattern "notepad|bloco" --regexOptions "0" --safesearch padWindow=value
runWindowsScript --scripttype "BATScript" --source "Text" --script "@echo off\r\ntaskkill /IM \"PID ne ${padWindow.ProcessId}\" /IM notepad.exe /T /F" --blockexecution