electron 打包,NSIS修改默认安装路径
2022-07-06 本文已影响0人
大咔丶
我们用NSIS打包electron做的exe时,默认安装路径都是C盘,如果想要修改默认安装路径,就需要写个NSIS脚本来修改。
1.package.json的nsis里添加
"include": "build/script/installer.nsh"
2.新建文件installer.nsh
!macro preInit
SetRegView 64
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "D:\Program Files\abc"
WriteRegExpandStr HkCU "${INSTALL_REGISTRY_KEY}" InstallLocation "D:\Program Files\abc"
SetRegView 32
WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "D:\Program Files\abc"
WriteRegExpandStr HkCU "${INSTALL_REGISTRY_KEY}" InstallLocation "D:\Program Files\abc"
!macroend