Bạn có thể sử dụng NSIS (miễn phí và mã nguồn mở). Nó rất linh hoạt, nhưng nó cũng có thể được sử dụng cho những nhiệm vụ đơn giản như vậy (và nó đã phục vụ tốt cho tôi trong những trường hợp như vậy). Giả sử tập tin của bạn được đặt tên yourapp.exe
và yourlib.dll
, bạn có thể sử dụng kịch bản này:
# 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
Install NSIS, tạo kịch bản này như archive.nsi
, nhấp chuột phải vào nó và chọn "Compile với NSIS". Tập tin archive.exe
sẽ được tạo.
Sau đó, trên hệ thống đích, tất cả người dùng cần làm là khởi chạy archive.exe
; tập lệnh sẽ giải nén và chạy chương trình của bạn.
(Nếu bạn muốn trở nên lạ mắt, bạn có thể xem hướng dẫn được cài đặt với NSIS hoặc see this page.)