0
我使用NSIS和下面給出的代碼創建安裝程序。創建成功創建安裝程序,但是當我在電腦卸載安裝程序首先insatllation過程中不產生,但是當我重新安裝,創建成功卸載>我能做些什麼plz幫助... 我NSI腳本:創建卸載程序時出錯
# declare name of installer file
!define PRODUCT_NAME "NepHotel"
Name "NepHotel"
outfile "NepHotel_setup.exe"
InstallDir $PROGRAMFILES\NepHotel
RequestExecutionLevel user
Page directory
Page instfiles
# open section
section ""
CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" ""
;create start-menu items
CreateDirectory "$SMPROGRAMS\NepHotel"
CreateShortCut "$SMPROGRAMS\NepHotel\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" "" "$INSTDIR\${PRODUCT_NAME}.exe" 0
CreateShortCut "$SMPROGRAMS\NepHotel\Readme.lnk" "$INSTDIR\user.props" "" "$INSTDIR\user.props" 0
CreateShortCut "$SMPROGRAMS\NepHotel\uninstall.lnk" "$INSTDIR\uninstall.exe" 1
;write uninstall information to the registry
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NepHotel" \
"DisplayName" "${PRODUCT_NAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\NepHotel" \
"UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
WriteUninstaller "$INSTDIR\Uninstall.exe"
SetOutPath $INSTDIR
File NepHotel.exe
File user.props
# end the section
sectionEnd
;Uninstaller Section
Section "Uninstall"
;Delete Files
RMDir /r "$INSTDIR\*.*"
;Remove the installation directory
RMDir "$INSTDIR"
;Delete Start Menu Shortcuts
Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
Delete "$SMPROGRAMS\${PRODUCT_NAME}\*.*"
RmDir "$SMPROGRAMS\${PRODUCT_NAME}"
;Delete Uninstaller And Unistall Registry Entries
enter code here DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\${PRODUCT_NAME}"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall \${PRODUCT_NAME}"
SectionEnd
Function .onInstSuccess
MessageBox MB_OK "You have successfully installed ${PRODUCT_NAME}. Use the desktop icon to start the program."
FunctionEnd
你的答案的第一線解決我的問題。我不知道爲什麼你發佈其餘關於RequestExecutionLevel用戶和東西是否有任何與我的問題relattion .. ???無論如何thanx的建議 – user1154781
安德斯在談論「InstallDir $ PROGRAMFILES \ NepHotel」:這可能會導致錯誤,因爲用戶無法寫入此目錄 - 管理員權限是必需的,所以他建議爲您一個簡單的管理權限檢查。 – Slappy