脚本:iTimeSync 1.15

优质
小牛编辑
133浏览
2023-12-01
引用iTimeSync.nsi的内容:

/*
NSIS安装向导
编写:张润华
*/
!ifndef 名称
!define 名称 'iTimeSync'
!endif
!ifndef 版本
!define 版本 '1.15'
!endif
!ifndef 版权
!define 版权 '张润华'
!endif
!system 'DEL /F "Uninstall.exe"'

SetCompressor /SOLID lzma
XPStyle on
Name "${名称}"
Icon "iTimeSync.ico"
UninstallIcon "uninstall.ico"
OutFile "${名称}.exe"
Caption "${名称}安装向导"
BrandingText '${名称} ${版本}'
InstallDir "$ProgramFiles\${名称}"
Page Directory
Page InstFiles
UninstPage UninstConfirm
UninstPage InstFiles
LoadLanguageFile "${NSISDIR}\Contrib\Language files\SimpChinese.nlf"
LangString Name ${LANG_SIMPCHINESE} "Simplified Chinese"
Function .onInit
BringToFront
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "myMutex") i .r1 ?e'
Pop $R0
StrCmp $R0 0 +3
MessageBox MB_OK|MB_IconExclamation "另一个${名称}安装向导正在运行."
Abort
FunctionEnd
Section
ExecWait '"$INSTDIR\Uninstall.exe" /S _?=$INSTDIR'
StrCpy $0 "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${名称}"
ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" "RegisteredOwner"
WriteRegStr HKLM "$0" "DisplayIcon" "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "$0" "DisplayName" "${名称}"
WriteRegStr HKLM "$0" "DisplayVersion" "${版本}"
WriteRegStr HKLM "$0" "Publisher" "${版权}"
WriteRegStr HKLM "$0" "UninstallString" "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "$0" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "$0" "RegOwner" "$R0"
WriteRegStr HKLM "$0" "Contact" "${版权}"
WriteRegStr HKLM "$0" "Comments" "${名称} ${版本}-制作:${版权}"
SetOutPath "$INSTDIR"
File /r "iTimeSync\*"
CreateDirectory "$SMPROGRAMS\${名称}"
CreateShortCut "$SMPROGRAMS\${名称}\${名称}.lnk" "$INSTDIR\iTimeSync.exe"
CreateShortCut "$SMPROGRAMS\${名称}\卸载${名称}.lnk" "$INSTDIR\Uninstall.exe"
CreateShortCut "$SMPROGRAMS\${名称}\${名称}说明.lnk" "$INSTDIR\说明.txt"
nsExec::ExecToLog 'attrib +r "$INSTDIR"'
Exec "$INSTDIR\iTimeSync.exe"
WriteUninstaller "$INSTDIR\Uninstall.exe"
quit
SectionEnd

Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe"
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${名称}"
RMDIR /r "$INSTDIR"
RMDIR /r "$SMPROGRAMS\${名称}"
SectionEnd

点击另存资源文件