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.
@env
and@or
commands, in your batch files. There should never be a need for justexit
to be a command at the end of your batch files either. I should also say that nobody should be using.bat
as a file extension for a script run bycmd.exe
. Those should use the.cmd
extension.