Knowledge Base Article

> Knowledge Base > Rapise

Created By  inflectra.adam Thursday, June 7, 2018

Sometimes you need to run a  Windows batch file (.BAT) from Rapise. Unlike an executable, you cannot simply use Global.DoLaunch() to execute it since it's not actually an application. This article provides the code you need to use.

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


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

  var wsh = new ActiveXObject("WScript.Shell");

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");
  wsh.Run("C:/Temp/test.bat", 2, true);




Article Info
  • Last Updated: 6/7/2018
  • Article ID: KB227
  • Views: 1314