How do you package an external exe file in your app


Hello I am trying to call a .exe file in my code and am wondering how I can include the exe file to be included into my installer. Along with includding it I am also wondering how I should find the directory. Currently I am just calling it statically by hard coding in the location of the .exe file but that obviuolsy wont work.
Tried storing the location like such
var exePath = 'file://' + __dirname + '/run.exe';
but the npm start and the installer create a bin folder which is remade every run. Any help would be appreciated.


Hi !

const app = require('electron').app; 
/* or require('electron') if you are in the main process */


should be what you’re looking for.


For anyone that is looking to do this the problem was that I was not adding my exe file while building my application. You need to edit your build.js file to look like this to include exes.

var paths = {
    jsCodeToTranspile: [
    copyFromAppDir: [
        './**/*.exe' <- This adds your exe file so you can call it