什么是使将使用Windows的Temp目录中的自解压压缩(SFX)的Windows程序安装程序中的最简单的方法? [英] What's the easiest way to make a self-extracting zip (SFX) Windows program installer that will use the Windows Temp directory?

查看:305
本文介绍了什么是使将使用Windows的Temp目录中的自解压压缩(SFX)的Windows程序安装程序中的最简单的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的程序,由.NET 2.0 EXE(Program.exe文件)调用一个x86的Win32 .dll文件(Lib.dll)的。

I have a very simple program that consists of a .NET 2.0 exe (Program.exe) that calls an x86 Win32 .dll (Lib.dll).

我想这些捆绑成一个单一的自解压压缩(SFX)称为Tool.exe Tool.exe将解压缩文件(Program.exe文件和Lib.dll)到Windows的临时系统目录下,然后调用Program.exe文件

I would like to bundle these into a single self-extracting zip (SFX) called Tool.exe Tool.exe will extract the files (Program.exe and Lib.dll) into the Windows Temp system directory, and then call Program.exe

这样我可以提供一个单一的文件.exe文件下载名为Tool.exe并尽可能对用户来讲,他们只是跑Tool.exe,而不是一个多档节目。

This way I can offer a single-file .exe download called Tool.exe and as far as the user is concerned they are just running Tool.exe and not a multi-file program.

WinRAR的有SFX的能力,并能够自动发起提取的.exe,但它似乎不给你,让其解压缩到Windows的Temp目录的选项(可以指定绝对路径,但临时目录变化取决于什么版本的Windows)。此外,它弹出时提取的窗口,这是矫枉过正我使其看起来像是用户的目标只是启动我的程序。

WinRAR has SFX capabilities, and ability to auto-launch an extracted .exe, but it doesn't seem to give you the option to let it extract to the Windows Temp dir (you can specify absolute path, but the Temp dir varies depending on what version of Windows). Also, it pops up a window when extracting, and that's overkill for my goals of making it appear like the user is just launching my program.

另外,有没有办法捆绑本地Lib.dll到我的编译.NET可执行程序,几乎像一个资源?

Alternatively, is there a way to bundle the native Lib.dll into my compiled .NET executable, almost like a "resource"?

我真的想避免做出一个完整的MSI甚至是普通.exe安装程序,因为这是一个痛苦的事,即使是像NSIS简单的安装程序。

I'd really like to avoid making a full on MSI or even a regular .exe installer as that is a pain to do, even with simpler installers like NSIS.

推荐答案

我倾向于只需 7-ZIP 并做< A HREF =htt​​p://upx.sourceforge.net/> UPX ,以下这些方向,使之运行在执行/提取一个批处理文件。这里有一个例子CMD脚本,我用它来构建的EXE包括在文件\ bin目录:

I tend to do this with just 7-zip and UPX, following these directions to make it run a batch file upon execution/extraction. Here's an example CMD script I use to build the EXE including the files in the .\bin directory:

pushd %~dp0
upx --ultra-brute 7zsd.sfx 
cd Bin
..\7za a -mx=9 "..\Program.7z" * 
cd ..
copy /b 7zsd.sfx + Config.txt + Program.7z Program_Name.exe
del Program.7z

本的config.txt文件读取这样的:

The config.txt file reads like this:

;!@Install@!UTF-8!
GUIMode="0"
RunProgram="runme.cmd" 
;!@InstallEnd@!

您的里程可能会有所不同,当然...

Your mileage may vary, of course...

这篇关于什么是使将使用Windows的Temp目录中的自解压压缩(SFX)的Windows程序安装程序中的最简单的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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