簡體   English   中英

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 的自定義安裝腳本中的customInstall宏中來做到這一點

package.json

"build": {
  "nsis": {
      "include": "build/installer.nsh",
  },

這是為了能夠使用自定義腳本。

並在build/installer.nsh

!macro customInstall
      CreateShortCut "$SMSTARTUP\filename.lnk" "$INSTDIR\filename.exe"
!macroend

在您的電子構建器配置中的頂級 nsis 鍵中使用“createStartMenuShortcut”選項:

"build": {
  "nsis": {
    "createStartMenuShortcut": true,
  },
  //Rest of the config
}

您可以在文檔中找到更多配置選項

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM