Electron Builder NSIS 在启动时创建快捷方式
Electron Builder NSIS Create a shortcut in startup
我正在使用 Electron Builder 为 windows 生成 NSIS 安装程序。我需要安装程序在启动菜单中创建快捷方式。
我该怎么做?
这是关于 NSIS 脚本的 Electron Builder 文档。 https://www.electron.build/configuration/nsis#custom-nsis-script
安装应用程序后要执行的代码应该放在哪里?
在电子构建器配置的顶级 nsis 键中使用 "createStartMenuShortcut" 选项:
"build": {
"nsis": {
"createStartMenuShortcut": true,
},
//Rest of the config
}
您可以在 the docs
中找到更多配置选项
我能够通过将创建快捷方式的代码放在 NSIS 的自定义安装脚本中的 customInstall
宏中来做到这一点
在package.json
"build": {
"nsis": {
"include": "build/installer.nsh",
},
这是为了能够使用自定义脚本。
并且在 build/installer.nsh
!macro customInstall
CreateShortCut "$SMSTARTUP\filename.lnk" "$INSTDIR\filename.exe"
!macroend
我正在使用 Electron Builder 为 windows 生成 NSIS 安装程序。我需要安装程序在启动菜单中创建快捷方式。
我该怎么做?
这是关于 NSIS 脚本的 Electron Builder 文档。 https://www.electron.build/configuration/nsis#custom-nsis-script
安装应用程序后要执行的代码应该放在哪里?
在电子构建器配置的顶级 nsis 键中使用 "createStartMenuShortcut" 选项:
"build": {
"nsis": {
"createStartMenuShortcut": true,
},
//Rest of the config
}
您可以在 the docs
中找到更多配置选项我能够通过将创建快捷方式的代码放在 NSIS 的自定义安装脚本中的 customInstall
宏中来做到这一点
在package.json
"build": {
"nsis": {
"include": "build/installer.nsh",
},
这是为了能够使用自定义脚本。
并且在 build/installer.nsh
!macro customInstall
CreateShortCut "$SMSTARTUP\filename.lnk" "$INSTDIR\filename.exe"
!macroend