我正在尝试做一个简单的安装程序,我想将一个zip文件复制到我的安装目录,并在那里解压缩它的内容,但是现在它只复制我的zip,并且不会解压缩它。
这是我的代码
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;--------------------------------
;General
Name "App" ; Name of the app to install
OutFile "setup.exe" ; Name of the app installer
InstallDir "c:\app\" ; App install directory (default C:)
InstallDirRegKey HKCU "Software\App" "" ; Get installation folder from registry if available
RequestExecutionLevel user ;Request application privileges for Windows Vista
Caption "App"
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Language Selection Dialog Settings
;Remember the installer language
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!define MUI_LANGDLL_REGISTRY_KEY "Software\App"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Language"
;--------------------------------
;Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "License.txt"
!insertmacro MUI_PAGE_COMPONENTS
!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
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English" ; Default English
!insertmacro MUI_LANGUAGE "Spanish" ; Spanish
;--------------------------------
; ZIP Handling
!include "ZipDLL.nsh"
;--------------------------------
;Installer Sections
Section "XAMPP" App
SetOutPath "$INSTDIR"
File App.zip
WriteRegStr HKCU "Software\App" "" $INSTDIR ; Store installation folder
; WriteUninstaller "$INSTDIR\Uninstall.exe" ; Create uninstaller
; !insertmacro ZIPDLL_EXTRACT "$INSTDIR\App.zip" "$INSTDIR" "<ALL>"
!insertmacro ZIPDLL_EXTRACT "C:\App\App.zip" "c:\App\" "<ALL>"
SectionEnd
;--------------------------------
;Descriptions
;Language strings
LangString DESC_App ${LANG_ENGLISH} "The server modules necesary to install app."
LangString DESC_App ${LANG_SPANISH} "Los modulos del servidor necesarios para instalar app"
;Assign language strings to sections
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${App} $(DESC_App)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Sections
;Section "Uninstall"
; ;ADD YOUR OWN FILES HERE...
; Delete "$INSTDIR\Uninstall.exe"
; RMDir "$INSTDIR"
; DeleteRegKey /ifempty HKCU "Software\App"
;SectionEnd
;--------------------------------
;Installer Functions
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
;--------------------------------
;Uninstaller Functions
; Function un.onInit
; !insertmacro MUI_UNGETLANGUAGE
; FunctionEnd
;--------------------------------
有什么建议吗?
答案 0 :(得分:0)
将RequestExecutionLevel设置为admin时,它不起作用?假设您正在安装程序文件,您将不得不这样做(尽管它也不会将zip解压缩到该文件夹)。你确定文件到位了吗?
答案 1 :(得分:0)
我使用NSIS的便携版编译我的安装程序。然后我在我的电脑上安装了完整版本,同样的脚本现在可以完美运行。