我正在创建一个Electron应用程序,并使用electron-winstaller来构建安装程序,它使用squirrel.windows。其中一个示例代码片段中包含以下部分:
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文档时,我不知道如何做到这一点。我在网上找不到任何例子。有谁有什么想法吗?
发布于 2021-02-12 10:34:29
Squirrel不公开更改注册表的命令,因此您必须编写自己的命令。CoffeeScript中的spawnReg
就是一个例子:https://gist.github.com/Hrxn/7f415e5e32abb83eff27
https://stackoverflow.com/questions/53936693
复制相似问题