微信搜索superit|邀请体验:大数据, 数据管理、OLAP分析与可视化平台 | 赞助作者:赞助作者

NSIS打包安装脚本

未分类 aide_941 19℃ 0评论

NSIS脚本中文报错 Bad text encoding

将nsi文件的编码格式从utf8改为gb2312

 

 

Name "WindowsFormsBroswer install Programe"
Caption "WindowsFormsBroswer install Describe"
OutFile "WindowsFormsBroswer_Setup.exe"
Unicode true
InstallDir "$PROGRAMFILES\WindowsFormsBroswer"

!include "MUI2.nsh"

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH

; 设置语言
!insertmacro MUI_LANGUAGE "SimpChinese"

; 检查.NET 4.8是否安装
Function CheckDotNet
    ReadRegDWORD $0 HKLM "SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full" "Release"
    IntCmp $0 528040 dotnet_installed dotnet_not_installed dotnet_not_installed

    dotnet_not_installed:
    MessageBox MB_OK "需要安装.NET Framework 4.8才能运行此程序"
    ExecWait '"$INSTDIR\dotNetFx40_Full_x86_x64.exe" /passive /norestart'
    dotnet_installed:
FunctionEnd

Section "Main Program"
    SetOutPath "$INSTDIR"
    File "bin\Release\WindowsFormsBroswer.exe"
    File "bin\Release\WindowsFormsBroswer.exe.config"
    File "bin\Release\chromedriver.exe"
    File "dotNetFx40_Full_x86_x64.exe"

    ; 创建开始菜单快捷方式
    CreateDirectory "$SMPROGRAMS\WindowsFormsBroswer"
    CreateShortCut "$SMPROGRAMS\WindowsFormsBroswer\WindowsFormsBroswer.lnk" "$INSTDIR\WindowsFormsBroswer.exe"

    ; 创建桌面快捷方式
    CreateShortCut "$DESKTOP\WindowsFormsBroswer.lnk" "$INSTDIR\WindowsFormsBroswer.exe"
SectionEnd

Function .onInit
    Call CheckDotNet
FunctionEnd

 

转载请注明:SuperIT » NSIS打包安装脚本

喜欢 (0)or分享 (0)

您必须 登录 才能发表评论!