2010-08-18 24 views
7

我有两个文件,一个EXE的DLL自解压,将解压并运行文件

的exe是一个vb.net应用程序的构建,我需要在那里太

的DLL什么我想要的是一个自我提取器,将这些文件放在一起,然后运行时它会提取它们,并且直接运行EXE

有没有一个非常简单和易于使用的盒子软件,将这样做?商业与否,没关系

回答

10

您可以使用NSIS(自由和开源)。它非常灵活,但它也可以用于这样简单的任务(在这种情况下它也很好)。假设你的文件被命名为yourapp.exeyourlib.dll,你可以使用这个脚本:

# this will be the created executable archive 
OutFile "archive.exe" 
# define the directory to install to, the installer's directory in this case 
InstallDir $EXEDIR 

# don't create a window for the unarchiver 
# You could get fancy and do all kinds of configuration 
# in the non-silent install; this example is the simplest it can be. 
SilentInstall silent 

# the executable part 
Section 

# define the output path for the following files 
SetOutPath $INSTDIR 
# define what to install and place it in the output path... 
# ...your app... 
File yourapp.exe 
# ...and the library. 
File yourlib.dll 

# run your application 
ExecShell yourapp.exe 

# done 
SectionEnd 

NSIS安装,创建此脚本为archive.nsi,右键单击它并选择“带NSIS编译”。文件archive.exe将被创建。

然后,在目标系统上,所有用户需要做的就是启动archive.exe;该脚本将解压缩并运行您的程序。

(如果您想要看中,可以查看使用NSIS安装的教程,或see this page。)