I'm building a desktop app for Windows using electron-packager
and electron-squirrel-startup
, I would like to execute some Windows cmd
commands during the installation of my application. To do so I was planning to use node-cmd
node module, but I doesn't really work inside the handleSquirrelEvents
function. An example command like this:
function handleSquirrelEvent(application) {
const squirrelEvent = process.argv[1];
switch (squirrelEvent) {
case '--squirrel-install':
case '--squirrel-updated':
var cmd=require('node-cmd');
cmd.run('touch example.created.file');
}
};
Seems to work. A file example.created.file in my_app/node_module/node-cmd/example directory is created.
But any other code does not work. Even if I only change the name of the file to be "touched" nothing happens.
Ok, example.created.file already exists in this directory and I suspect that you can only use update.exe supported commands in
case '--squirrel-updated'
sections. So this will not work.