openfin to launch external batch process with cmd console minimized

48 Views Asked by At

I am using below Javascript code to launch external process from openfin on Windows,

fin.System.launchExternalProcess({
      path: myApp.bat,
      listener: function (result) { console.log('Launching process: ', result.exitCode); }
    })
    .then(payload => { console.log('process launched') })
    .then(() => { console.log('process is up') })
    .catch(err => console.log(err));

where myApp.bat is like:

@REM env setup and start java
java ...

The process is launched and runs successfully. But there is a visible cmd.exe window, which I'd like to be hidden, or at the very least minimized.

I can modify my batch file to use use javaw.exe or start to get rid of the cmd console,

@REM env setup and start java
javaw 
@REM or
start /min java
exit

but java.exe/javaw.exe will run in a background process and disconnects from openfin, and I won't be able to stop the process from openfin anymore.

Please help with a solution to run the batch file without a visible cmd.exe window, but where openfin can still control, (terminate), the process later.

0

There are 0 best solutions below