C ++中的自解压存档 [英] Self Extracting Archive in C++

查看:79
本文介绍了C ++中的自解压存档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为Windows创建一个自解压存档,将文件解压缩到一个临时文件夹,然后运行提取的启动脚本,我该如何做呢?



注意:

我想使用完全原生的win32 c ++,因为这样做的全部意义就是要下载多个文件。



-Jordan

I would like to create a self extracting archive for windows that will extract files to a temporary folder and then run the extracted startup script, how would I go about doing this?

Note:
I would like to use completely native win32 c++ because the whole point of this is to get around having to download multiple files.

-Jordan

推荐答案

这个问题既不新颖也不独特。我会尝试搜索现有的免费解决方案。尝试7z sfx怎么样? http://sourceforge.net/projects/s-zipsfxbuilder/?source=dlp [ ^ ]

some sfx解压缩器有一个提取后运行命令选项,一些sfx构建器有一个选项自动提取到临时文件夹和在执行命令后删除临时文件夹选项。
This problem is neither new nor unique. I would try to search for an existing free solution. What about trying 7z sfx? http://sourceforge.net/projects/s-zipsfxbuilder/?source=dlp[^]
Some sfx decompressors have a "run command after extract" option and some sfx builders have an option to "auto extract to temp folder" and "delete temp folder after command execution" option.


这是一个非常受欢迎的拉链包装的开源解决方案 http://www.7-zip.org/ [ ^ ]
Here is a well admired open source solution of the zip packing http://www.7-zip.org/[^]


首先,您可以使用以下功能:

http:// msdn.microsoft.com/en-us/library/windows/desktop/aa364992%28v=vs.85%29.aspx [ ^ ]

检索指定临时目录的路径文件(%WINDIR%\ temp)



像这样:

Firstly you can use the following function :
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364992%28v=vs.85%29.aspx[^]
to retrieves the path of the directory designated for temporary files (%WINDIR%\temp)

Like this:
TCHAR buf [MAX_PATH];

if (GetTempPath (MAX_PATH, buf) != 0)
{
  //Here you can to do extracting yours archive, run script

}





使用以下示例之一:

http://www.example-code.com/vcpp/vcUnzip.asp [ ^ ]

Zip Utils - 干净,优雅,简单,C ++ / Win32 [ ^ ]]

以MFC方式压缩和解压缩 [ ^ ]

在MFC下读取/写入Zip兼容文件的简便方法 [ ^ ]



祝你好运



Use one of the following examples:
http://www.example-code.com/vcpp/vcUnzip.asp[^]
Zip Utils - clean, elegant, simple, C++/Win32[^]]
Zip and Unzip in the MFC way[^]
Easy Way to Read/Write Zip-Compatible Files Under MFC[^]

Good luck


这篇关于C ++中的自解压存档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆