How to execute .bat in local folder?

Is there a way to execute a .bat file in the local folder?
Because since Nwjs is limited to the way It can manipulate and interact with many things in the computer, batch programs can do a lot better job sometimes.

I tried using child process, with spawn and exec, but both doesn't seem to work...
Browsers are intentionally sandboxed to prevent websites from executing local files with local rights - otherwise there would be a lot more virus and malware infections.
To get a batchprogram to run (which has local rights) you'll have to override that protection - and then hope that the player's AntiVirus doesn't block that call as a malware attempt.

I suggest looking for an alternative - can you tell us what you want to do (instead of how you want to do it)? Perhaps some one can point you to an alternative.
Browsers are intentionally sandboxed to prevent websites from executing local files with local rights - otherwise there would be a lot more virus and malware infections.
To get a batchprogram to run (which has local rights) you'll have to override that protection - and then hope that the player's AntiVirus doesn't block that call as a malware attempt.
Browsers are, but NWjs/NodeJS isn't. Problem is, for some reason I can't manage to use a code (which would work for others, in other forums) in MV

One example is
Code:
var child_process = require('child_process');

child_process.exec('path_to_your_executables', function(error, stdout, stderr) {
    console.log(stdout);
});
from here


Btw: As I said in a post before, I'm trying to make some kind of terminal/shell/cmd which would put many diferent functions of javascript together. That's something similar to an old project of mine that I made in Game Maker (A multi-tools program, integrating much stuff, like a web browser, music player, zip/unzip, video player,etc all in one, with a simple interface) which helped me a lot to learn how GML and game maker itself works.
if i have good memory , you need to take a look inside arg you can add to your chromium app.
Good list avaible.
https://peter.sh/experiments/chromium-command-line-switches/

after inside your package json your can inject arg to disable local security from chromium.
this is a example how you can add args in your app".
PHP:
{   "_comment": "nwjs Manifest format",
    "name": "d",
    "version": "0.9.8A",
    "main": "index.html",
    "js-flags": "--expose-gc",
    "description": "demo app of node-webkit",
  "keywords": [ "demo", "node-webkit" ],
    "chromium-args" : "--force-gpu-mem-available-mb=10000 --show-fps-counter --enable-gpu-rasterization --enable-gpu-memory-buffer-video-frames --enable-native-gpu-memory-buffers ",
    "window": {
        "title": "",
        "width": 900,
        "height": 624,
        "icon": "icon/icon.png"
    }
}

search maybe for keyword " security " or "sandbox"
i i have good memory , you need to take a look inside arg you can add to your chromium app.
Good list avaible.
https://peter.sh/experiments/chromium-command-line-switches/

after inside your package json your can inject arg to disable local security from chromium.
this i a example how you can add arg.
PHP:
{   "_comment": "nwjs Manifest format",
    "name": "d",
    "version": "0.9.8A",
    "main": "index.html",
    "js-flags": "--expose-gc",
    "description": "demo app of node-webkit",
  "keywords": [ "demo", "node-webkit" ],
    "chromium-args" : "--force-gpu-mem-available-mb=10000 --show-fps-counter --enable-gpu-rasterization --enable-gpu-memory-buffer-video-frames --enable-native-gpu-memory-buffers ",
    "window": {
        "title": "",
        "width": 900,
        "height": 624,
        "icon": "icon/icon.png"
    }
}
I tried adding many args but it still gives me "Block-scoped declarations (let,const,function,cass) not yet supported outside strict mode"
My list:
Code:
    "chromium-args" : "--force-gpu-mem-available-mb=10000 --enable-gpu-rasterization --enable-local-file-accesses --allow-running-insecure-content --allow-no-sandbox-job --disable-web-security  --enable-gpu-memory-buffer-video-frames --enable-native-gpu-memory-buffers ",

Is there a way around it?
I tried adding many args but it still gives me "Block-scoped declarations (let,const,function,cass) not yet supported outside strict mode"
My list:
Code:
    "chromium-args" : "--force-gpu-mem-available-mb=10000 --enable-gpu-rasterization --enable-local-file-accesses --allow-running-insecure-content --allow-no-sandbox-job --disable-web-security  --enable-gpu-memory-buffer-video-frames --enable-native-gpu-memory-buffers ",

Is there a way around it?
Have you , the new rmmv with the new node.js ?
You could always use a Child Process to do it
documentation can be found here: https://nodejs.org/api/child_process.html
as for code; would probably looks something like this
Code:
var path = require(path);
var childProcess = require('child_process');

childProcess.exec(path.resolve('./batch.bat'),{},function(error,stdout,stderr){
    console.error(String(error));
    console.log(stdout);
    console.warn(stderr);
});
although actual code may vary; and also; this should only work for desktop version of MV, any other versions will not be able to use path or child process, since its a node specific function.

*edit*
also; some versions of MV, aka pre 1.6, may have trouble finding the path while playtesting. this can be solved by using process.mainModule instead of '.'
an example would be like so.
Code:
childProcess.exec(path.resolve(process.mainModule.replace('index.html','batch.bat'))...

Original thread: https://forums.rpgmakerweb.com/threads/how-to-execute-bat-in-local-folder.93680/