Search code examples
electronsquirrel.windows

Creating Shortcuts for an Installed Electron Application


I have an electron application for which I use electron-packager to compile and grunt-electron-installer to generate the Windows installer package.

Upon installation I handle the squirrel events like so:

//...

  switch (squirrelCommand) {
      case '--squirrel-install':
      case '--squirrel-updated':
        createShortcuts(cleanUp);
        break;
//...

and the createShortcuts function just spawns a child process to call the Update.exe (Squirrel.exe) with the --createShortcut=myapp.exe arguments

This works, however, when the shortcut it generated it is named Electron instead of myapp.

I don't see any other ways to specify the output name of the shortcut, so how would I change the generated shortcut to say myapp?

Here is the snippet of the squirrel logs:

2016-03-20 10:34:35> ApplyReleasesImpl: Creating shortcut for myapp.exe => C:\Users\zeus\Desktop\Electron.lnk
2016-03-20 10:34:35> ApplyReleasesImpl: About to save shortcut: C:\Users\zeus\Desktop\Electron.lnk (target C:\Users\zeus\AppData\Local\myapp\Update.exe, workingDir C:\Users\zeus\AppData\Local\myapp\app-0.0.3, args --processStart myapp.exe)

Solution

  • Upon further investigation into electron-packager I found a more detailed explanation about the resource editing here.

    using the electron-packager command line I pass these arguments to update the embedded electron exe information:

    electron-packager ... --version-string.CompanyName="Company Inc." --version-string.ProductName="Product" ...
    

    The grunt-electron-installer will look for this embedded application information to generate the name for the shortcut.