How to create registry entries using squirrel.windows
Asked Answered
P

1

6

I am creating an Electron application, and am using electron-winstaller to build the installer, which uses squirrel.windows. Inside of one of the example code snippets has this section:

const squirrelEvent = process.argv[1];
switch (squirrelEvent) {
  case '--squirrel-install':
  case '--squirrel-updated':
    // Optionally do things such as:
    // - Add your .exe to the PATH
    // - Write to the registry for things like file associations and
    // explorer context menus

    // Install desktop and start menu shortcuts
    spawnUpdate(['--createShortcut', exeName]);

    setTimeout(app.quit, 1000);
    return true;

  case '--squirrel-uninstall':
    // Undo anything you did in the --squirrel-install and
    // --squirrel-updated handlers

    // Remove desktop and start menu shortcuts
    spawnUpdate(['--removeShortcut', exeName]);

    setTimeout(app.quit, 1000);
    return true;

  case '--squirrel-obsolete':
    // This is called on the outgoing version of your app before
    // we update to the new version - it's the opposite of
    // --squirrel-updated

    app.quit();
    return true;
  }
}

In the section above that says "- Write to the registry for things like file associations and explorer context menus.". I would like to add registry entries here, but when looking at the squirrel documentation I could not figure how to do this. I could not find any examples online. Anyone have any ideas?

Papp answered 26/12, 2018 at 20:13 Comment(2)
Do you have any solution for this question ?Weiland
Same here... I'm building an kiosk app and I need to disable the Windows 10 lateral swipe events. I think I can do it adding an registry key to disable that feature, but I don't know how can I write the values to registry in the '--squirrel-install' and '--squirrel-updated' events, inside that script. Did you found a way?Puffball
L
0

Squirrel does not expose commands to change registry, so you would have to write your own. An example is spawnReg in this CoffeeScript: https://gist.github.com/Hrxn/7f415e5e32abb83eff27

Lovett answered 12/2, 2021 at 2:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.