After some research ... I created a class that do the job.
Basically, we have 4 parameters.
- programAbsolutePath: Where is the batch file to execute?
- parameters: Which are the parameters of the batch file?
- environmentVariables: If you want to override some environment variables
- baseDirectory: Which will be the base directory of the batch?. This could be usefull when the batch file use relative paths in its process.
This class only executes batches for unix/windows. If you want to use it in other Operating Systems you should specify which are the execution path (like EXEC_WINDOWS and EXEC_UNIX constants)