1

我正在尝试做一个简单的安装程序,我想将一个 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
;--------------------------------

有什么建议么?

4

2 回答 2

0

将 RequestExecutionLevel 设置为 admin 时它也不起作用?假设您要安装到程序文件,则必须这样做(尽管它也不会将 zip 解压缩到该文件夹​​)。你确定文件到位了吗?

于 2013-02-20T20:44:02.463 回答
0

我正在使用 NSIS 的便携版本来编译我的安装程序。然后我在我的电脑上安装了完整版,同样的脚本现在可以完美运行。

于 2013-02-20T21:02:42.420 回答