Trying to execute a .bat file from an activity rule

I'm trying to execute a .bat file from an activity rule. The logic in a similar post is not working as a .bat. I've tried several ways to get it to run. It doesn't throw an error, but the Java step does not seem to execute the .bat file. Any help is appreciated. I'm using PRPC 7.1.8. I have to execute a .bat file, so not doing it is not an option.

Logic 1

ProcessBuilder pb = new ProcessBuilder("d:\\DEV\\Forms\\PrintPageToPDF_F-9015.bat");


Process process = pb.start();


catch( ioEx) {

oLog.error("WritePDFScriptFiles - ", ioEx);


Logic 2

String path="cmd /c start d:\\DEV\\Forms\\PrintPageToPDF_F-9015.bat";
Runtime rn=Runtime.getRuntime();
Process pr=rn.exec(path);

Logic 3

String[] cmdArray = new String[3];
cmdArray[0] = "cmd.exe";
cmdArray[1] = "/c";
cmdArray[2] = "d:\\DEV\\Forms\\PrintPageToPDF_F-9015.bat";

Correct Answer
March 7, 2019 - 10:54am

From the first link from Santanu, I was able to get the batch file to execute.  Thanks!


Keep up to date on this post and subscribe to comments

February 20, 2019 - 7:22am


There is no OOTB way. You need to write your custom java code in activity to get it done. 

Just some pointer.


March 7, 2019 - 10:54am

From the first link from Santanu, I was able to get the batch file to execute.  Thanks!

May 22, 2019 - 9:33am
Response to DavidD95

Hi David, Greetings!
I am also trying to achieve this, can you pass me the exact code for the same please.

Harsha K

May 23, 2019 - 7:43am
Response to Harsha K

nevermind, I have manged to achieve this, Thanks for the post!

Harsha K

August 16, 2019 - 11:30am


This is my logic to accomplish this in a Java step in an activity rule.  It works in my Development and QA environments on a single node, single server instance, but not in my Model and Production, 2 node, 2 server environments.  It does not open and execute the .bat file.  In Task Manager, I don't see the cmd window opening in execution.  In Development, I do.  I opened a SR with Support and they said it was J2EE security, but the settings are the same.  Any ideas are welcomed.


String[] cmdArray = new String[4];

cmdArray[0] = "cmd.exe";

cmdArray[1] = "/C";

cmdArray[2] = "Start";

cmdArray[3] = "D:\\PDFGen\\FORMS_PrintPageToPDF_F-118503.bat";


    oLog.error("WritePDFScriptFiles - BATCHFILEPATH is " + BATCHFILEPATH);

  oLog.error("WritePDFScriptFiles - After execution of cmd");

try {


  catch (Exception e) {

oLog.error("WritePDFScriptFiles - ", e);



catch(Exception ioEx) 

  oLog.error("WritePDFScriptFiles - ", ioEx);

  throw new PRRuntimeException(ioEx);