首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何使用squirrel.windows创建注册表项

如何使用squirrel.windows创建注册表项
EN

Stack Overflow用户
提问于 2018-12-27 04:13:10
回答 1查看 697关注 0票数 6

我正在创建一个Electron应用程序,并使用electron-winstaller来构建安装程序,它使用squirrel.windows。其中一个示例代码片段中包含以下部分:

代码语言:javascript
运行
复制
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;
  }
}

在上面的部分中写着"-向注册表写入文件关联和资源管理器上下文菜单等内容。“我想在这里添加注册表项,但在查看squirrel文档时,我不知道如何做到这一点。我在网上找不到任何例子。有谁有什么想法吗?

EN

回答 1

Stack Overflow用户

发布于 2021-02-12 10:34:29

Squirrel不公开更改注册表的命令,因此您必须编写自己的命令。CoffeeScript中的spawnReg就是一个例子:https://gist.github.com/Hrxn/7f415e5e32abb83eff27

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53936693

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档