XRun not working with batch files

You can start Powershell scripts directly from XRunAndWait:

See here:

PS1 Script:

$param1=$args[0]
write-host $param1 

$param2=$args[1]
write-host $param2

$r = [int]$param1 * [int]$param2

exit $r

Macro:

{
  "Name": "ps1",
  "CreationDate": "2021-12-22",
  "Commands": [
    {
      "Command": "echo",
      "Target": "start",
      "Value": "blue",
      "Description": ""
    },
    {
      "Command": "XRunAndWait",
      "Target": "powershell.exe",
      "Value": " -ExecutionPolicy Bypass -File \"C:\\tst1\\test.ps1\" 8 33",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Done, exit code is ${!xrun_exitcode}",
      "Value": "green",
      "Description": ""
    }
  ]
}

See also:

2 Likes