Execute createShortcut in a Squirrel event, in an Electron app Execute createShortcut in a Squirrel event, in an Electron app powershell powershell

Execute createShortcut in a Squirrel event, in an Electron app


It took me awhile to understand how to do this myself. The Squirrel.Windows Update.exe has the ability to create shortcuts to your app for you. I wrote a blog post called Creating a Windows Distribution of an Electron App using Squirrel and in it I have Squirrel create the shortcuts for me. If you want to go this route, this is simplified version of how to have Squirrel create the shortcuts for you:

var cp = require('child_process');    var updateDotExe = path.resolve(path.dirname(process.execPath), '..', 'update.exe');var target = path.basename(process.execPath);var child = cp.spawn(updateDotExe, ["--createShortcut", target], { detached: true });child.on('close', function(code) {    app.quit();});

You need to hack the electron executable using Resource Hacker, rcedit, or another application to change the ProductName and Icon resources. You'll want to call the above code on both the install and updated Squirrel events.