简体   繁体   English

使用NSIS安装程序存档当前安装的文件

[英]Archive currently installed files using a NSIS installer

I am trying to customize my installer accordingly, so that it looks, wether there are specific folders in the $INSTDIR, which is getting set on a MUI_PAGE_DIRECTORY. 我正在尝试相应地自定义安装程序,以便使其看起来,$ INSTDIR中是否有特定的文件夹,该文件夹已在MUI_PAGE_DIRECTORY上进行设置。 If it finds these folders, it should compress them and put that archive into a backup-folder under $INSTDIR and set it's name according to the date. 如果找到这些文件夹,则应压缩它们并将该存档放入$ INSTDIR下的备份文件夹,并根据日期设置其名称。

I have searched long to find a solution for this, but I did not find any compression plugins nor did I figure out how to ship a 7zip with it and use that for compression. 我已经搜索了很长时间,以找到解决方案,但是我没有找到任何压缩插件,也没有弄清楚如何随同提供7zip并将其用于压缩。 I am not as fit with NSIS though. 我不太适合NSIS。

Code not tested, but it should help... 代码未经测试,但是应该可以帮助...

# Bundle 7zip archiver and extract it to TEMP folder
File "/oname=$TEMP\7za.exe" 7za.exe
# If target directory exists...
${If} ${FileExists} "$INSTDIR"
    # Create archive on temp folder
    execwait '"$TEMP\7za.exe" a "$INSTDIR\archive.7z" "$INSTDIR\folder_to_backup"'
${EndIf}
Delete "$TEMP\7za.exe"

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

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