可在百度下载NSIS与nisedit,也可在我的资源下载->资源
使用nisedit2.0.3.exe向导生成.nsi文件脚本
可以在文件的结尾的SectionEnd再加上下面一段代码 这样可以实现安装完成后再安装程序所需要的运行环境
LangString str_install_vc ${LANG_SIMPCHINESE} "建议安装VC++2015软件运行环境!$\n如果已经安装,可以不必重复安装"
LangString str_install_vc ${LANG_ENGLISH} "Do you want to install the VC ++ 2015 runtime that is required for$\n the software to run? If it is already installed, you can not repeat the$\n installation."
; Optional section (can be disabled by the user)
Section "Install vc"
MessageBox MB_YESNO $(str_install_vc) IDNO done
Exec '"$INSTDIR\vcredist_x86.exe"'
done:
SectionEnd
值得提醒的是在nsis脚本中换行符号为 $\n 回车为 $\r Tab为 $\t
关于MessageBox的设置:
MessageBox只显示一个确定按钮:MB_OK - Display with an OK button
MessageBox显示确定和取消两个按钮:MB_OKCANCEL - Display with an OK and a cancel button
MessageBox显示中止、重试和忽略三个按钮:MB_ABORTRETRYIGNORE - Display with abort, retry, ignore buttons
MessageBox显示重试和取消两个按钮:MB_RETRYCANCEL - Display with retry and cancel buttons
MessageBox显示是和否两个按钮:MB_YESNO - Display with yes and no buttons
MessageBox显示是、否和取消三个按钮:MB_YESNOCANCEL - Display with yes, no, cancel buttons