如何在使用InnoSetup安装程序时创建目录并将exe文件复制到此目录?

时间:2013-06-08 22:05:20

标签: inno-setup

我有InnoSetup的自动脚本:

; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId=
AppName=VideoScreenRecorder
AppVersion=1.5
;AppVerName=VideoScreenRecorder 1.5
AppPublisher=Daniel Lipman
DefaultDirName={pf}\VideoScreenRecorder
DefaultGroupName=VideoScreenRecorder
InfoBeforeFile=D:\ScreenVideoRecorderHelp.txt
OutputDir=D:\ScreenVideoRecorderCompiler
OutputBaseFilename=Setup
SetupIconFile=D:\Activity Monitor.ico
Compression=lzma
SolidCompression=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "D:\C-Sharp\ScreenVideoRecorder\ScreenVideoRecorderWorkingVersion\bin\Debug\ScreenVideoRecorder.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{group}\VideoScreenRecorder"; Filename: "{app}\ScreenVideoRecorder.exe"
Name: "{commondesktop}\VideoScreenRecorder"; Filename: "{app}\ScreenVideoRecorder.exe"; Tasks: desktopicon

[Run]
Filename: "{app}\ScreenVideoRecorder.exe"; Description: "{cm:LaunchProgram,VideoScreenRecorder}"; Flags: nowait postinstall skipifsilent

安装采用exe文件VideoScreenRecorder并将其复制安装在程序文件目录中......等等

我想要做的是在安装中添加另一个exe文件:ffmpeg.exe 我希望安装程序将在特定位置创建一个目录,例如c:\ test,并将ffmpeg.exe放在此目录中。

主exe文件是VideoScreenRecorder.exe,但我还需要将ffmpeg.exe复制到另一个特定目录。

ffmpeg.exe所在的目录是:

C:\ Users \用户名\ AppData \ Local \ ScreenVideoRecorder \ ScreenVideoRecorder \ workingDirectory 我需要安装目录在这个地方创建目录,然后将ffmpeg.exe复制到workingDirectory。

我该怎么做?

1 个答案:

答案 0 :(得分:4)

您可以为每个文件制作DestDir,无论您喜欢什么,在这种情况下,使用Inno Setup实施的Constants之一。

[Files]
Source: "X:\PathToFFMPEGSource\ffmpeg.exe"; 
DestDir: "{localappdata}\ScreenVideoRecorder\ScreenVideoRecorder\workingDirectory"; 
Flags: ignoreversion

*其中X是源ffmpeg.exe所在的驱动器号。