Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
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
Solved! Go to Solution.
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();
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 🙂
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