自解压程序,可提取并运行文件。

8

我有两个文件,一个是EXE文件,一个是DLL文件

这个EXE文件是VB.NET应用程序的构建文件,我需要将DLL文件放到里面

我的需求是创建一个自解压程序,能够将这些文件组合在一起,当运行时可以将它们解压并立即运行EXE文件

是否有非常简单易用的开箱即用软件可以实现这个功能?商业或免费均可。

2个回答

11

您可以使用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教程或参见此页面。)

1
你可以尝试使用WinZip

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接