When you drag an application .EXE from the Files explorer to the main test script window (MyTest.js), Rapise automatically adds the following code:

     Global.DoLaunch('../../../../../Temp/test.exe');

This works well for executables, but for Windows Batch files (ones ending in .BAT), you need to use a different syntax, as shown below:

     Global.DoCmd('c:/Temp/test.bat');

Sometimes, you may want to use lower lever API's to have more fine grained control over execution, i.e.:

  var wsh = new ActiveXObject("WScript.Shell");
  wsh.Run("C:/Temp/test.bat");

This call will launch a batch file and return without waiting for it to finish. If you need to run in synchronously then you need to add a couple of parameters to the call:

  var wsh = new ActiveXObject("WScript.Shell");
  var errCode = wsh.Run("C:/Temp/test.bat", 2, true);

You may see, that we can get process error code in this case.

Please, note. If path to a test file contains space, then full path to your batch file should be enclosed in double quotes like that:

  var wsh = new ActiveXObject("WScript.Shell");
  var errCode = wsh.Run('"C:/Path with Spaces/test.bat"', 2, true);

Also note, that if you refer to the path using %WORKDIR% and it may contain a path then it is saver to use a quote:

  var wsh = new ActiveXObject("WScript.Shell");
  var errCode = wsh.Run('"%WORKDIR%/test.bat"', 2, true);

By default WORKDIR points to the folder of the parent test. So if BAT file you launch is inside the test folder you can omit %WORKDIR%.