cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

How to run .bat file in trigger scripting of Integrity

vbabu-4
10-Marble

How to run .bat file in trigger scripting of Integrity

How to run a batch file in trigger script of Integrity?

java.lang.Runtime.getRuntime().exec('cmd /c start E:\\oval\\CPProject.bat');

is above command is right to execute batch using JAVA API in Integrity server.

I am able to write and read batch file using JAVA API script but above command does not execute the batch file after writing. Kindly help me to execute the batch file in Integrity server. 

Thanks in advance

ACCEPTED SOLUTION

Accepted Solutions

When doing something similar I think I had to specify the complete path to "cmd". Here is a code snippet I used:

var exec = "C:\\Windows\\System32\\cmd.exe /C C:\\Progra~1\\Integrity\\IntegrityServer10\\data\\triggers\\scripts\\batchFile.bat";

var r = java.lang.Runtime.getRuntime();

var p1 = r.exec(exec);

var returnCode = p1.waitFor();

View solution in original post

3 REPLIES 3

When doing something similar I think I had to specify the complete path to "cmd". Here is a code snippet I used:

var exec = "C:\\Windows\\System32\\cmd.exe /C C:\\Progra~1\\Integrity\\IntegrityServer10\\data\\triggers\\scripts\\batchFile.bat";

var r = java.lang.Runtime.getRuntime();

var p1 = r.exec(exec);

var returnCode = p1.waitFor();

Thanks a lot it works for me 🙂

mrump
16-Pearl
(To:vbabu-4)

Please keep in mind, that any process you start inside a trigger context is/might be "blocking" the trigger and therefore your entire server for all other users.

If you do not detach the severtrigger and yout batch operations it can lead to serious performance issues.

detach a long running process from the trigger context that started it

Announcements


Top Tags