I have to execute a batch script on click of a button and I dont know where to begin. The batch scripts will do various different tasks for my nwjs application.
<input type="button" onclick="BatchFunc()"></button>
function BatchFunc() {
code here
}
I tried this in various ways but got no success
function OpenTest() {
nw.Shell.openItem('test.txt');
}
I tried this and when i click on the input it just shows a loading icon for a second then doesnt do anything else.
<script type="text/javascript">
function runBatchFile () {
const path = require('path');
const executable = path.join('SOURCE CODE' , 'BATCH' , 'file.bat');
const executableAndArgs = executable + ' --force --whatever';
runExecutable(executableAndArgs, function (chunk) {
console.log({ chunk });
});
}
</script>

