3,245
社区成员
发帖
与我相关
我的任务
分享
!include x64.nsh
Name Example
OutFile Example.exe
Section Install
SetOutPath $INSTDIR
// 打包你自己的程序文件(本机路径)
File /r ".\dir1\*"
// 创建桌面快捷图标
CreateShortcut "$DESKTOP\AppName.lnk" "$INSTDIR\app.exe"
// 创建卸载程序
WriteUninstaller "$INSTDIR\uninst.exe"
SetOutPath $SYSDIR // $SYSDIR: System32 (x86) / SysWow64 (x64)
// 打包其他文件(本机路径)
File ".\dir2\xxx_x86.ocx"
ExecWait `"$SYSDIR\regsvr32.exe" /s "$SYSDIR\xxx_x86.ocx"`
// 如果不考虑64位,这段判断可以不要。
// 比如你的程序和 ocx 都是32位。
// 64位平台下释放并注册64位文件
${If} ${RunningX64}
${DisableX64FSRedirection} // $SYSDIR: SysWow64 => System32 (x64)
// 打包其他文件(本机路径)
File ".\dir2\xxx_x64.ocx"
ExecWait `"$SYSDIR\regsvr32.exe" /s "$SYSDIR\xxx_x64.ocx"`
${EnableX64FSRedirection} // $SYSDIR: System32 => SysWow64 (x64)
${EndIf}
SectionEnd
这是个基本的参考,并没有包含卸载程序。