Using node-cmd module while handling Squirrel Events function

162 views Asked by At

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.

1

There are 1 answers

0
madasionka On BEST ANSWER

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.