Below is the current code I use in a Gulp task to run a bat file. The path is absolute.
var gulp = require('gulp');
var exec = require('child_process').exec;
module.exports = function() {
// Merges the CSS and JS files
return exec("C:/git/xxxx/Config/BuildScripts/buildassets.bat",
function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
}
);
};
I want to make it as relative path, but when I change it to a relative path,
return exec('../../../Config/BuildScripts/buildassets.bat'
I get the following error:
'..' is not recognized as an internal or external command, operable program or batch file.
How can I reference this file relatively?
I am doing this for that purpose but in my main process not in gulp file.
const app = electron.app;
const exec = require('child_process').exec;
var path = app.getAppPath();
exec(`"${path}\\path\\toexe.exe"`, function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With