简体   繁体   English

Nsis 脚本:尝试编写一个脚本,从 zip 文件中提取特定目录并将其添加为安装程序的一部分(可执行文件)

[英]Nsis script: Trying to write a script which extracts specific directory from a zip file and adds it as a part of installer(executable)

I have zip file say Texas.zip .我有 zip 文件说 Texas.zip 。 It contains 2 directories Newyork and Manhattan.它包含 2 个目录纽约和曼哈顿。 Newyork has two files A.txt and B.txt , while Manhattan has C.txt and D.txt.纽约有两个文件 A.txt 和 B.txt ,而曼哈顿有 C.txt 和 D.txt 。 I want to extract only Newyork and 2 files associated inside it.我只想提取 Newyork 和其中关联的 2 个文件。 The below script helps me extract a specific file inside Newyork but not the entire directory.下面的脚本帮助我提取 Newyork 中的特定文件,而不是整个目录。 Please do tell me how to extract a specific directory and its contents from the zip.请告诉我如何从 zip 中提取特定目录及其内容。 SCRIPT:脚本:

Section "TEST1"
  InitPluginsDir
    #SetOutpath "$INSTDIR"
      
      nsisunz::UnzipToStack /file  "Texas\Newyork\A.txt" "D:\Files\Texas.zip" "D:\Output folder"
      
      Pop $0
    DetailPrint "$0" ;print message to log
  SectionEnd* 

DESIRED OUTPUT : Inside D:\\Output folder\\ post installation of the exe i must see D:\\Output folder\\Newyork * where '*' denotes both files A.txt and B.txt .所需的输出:在 D:\\Output folder\\ 安装 exe 后,我必须看到 D:\\Output folder\\Newyork * 其中 '*' 表示文件 A.txt 和 B.txt 。

This plug-in does not support advanced options like this, you must use nsUnzip instead.此插件不支持此类高级选项,您必须使用nsUnzip代替。

CabX and some of the 7z plug-ins also supports this if you are willing to change archive format.如果您愿意更改存档格式,CabX 和一些 7z 插件也支持此功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM