我需要一些帮助来制作一个Inno安装程序,我想在我自己的项目的同一时间安装驱动程序。 当驱动程序只是一个“exe”文件时,它可以正常工作:
[Files]
Source: ".\Component\Drivers\Driver1\driver1.exe"; DestDir: "{tmp}"; Check: Is64BitInstallMode;
[Codes]
ExtractTemporaryFile('driver1.exe');
Exec(ExpandConstant('{tmp}\driver1.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
但是当司机对于家属来说更复杂时,这不是同一个交易。 我试图将所有文件放在临时目录中(是的,这是丑陋=))并执行驱动程序,但此解决方案不起作用。
[Files]
Source: ".\Component\Drivers\Keithley Driver\*"; DestDir: "{tmp}"; Check: Is64BitInstallMode;
[Code]
ExtractTemporaryFile('setup.exe');
Exec(ExpandConstant('{tmp}\setup.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
对我有好的建议吗? 我可以在一个“exe”文件中压缩驱动程序及其所有依赖项吗? Thanx为您提供帮助,最诚挚的问候, 克莱门特。
更新2: 这是我的entir代码:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "App"
#define MyAppVersion "1.0"
#define MyAppPublisher "Other"
#define MyAppURL "http://www.other.fr"
#define MyAppExeName "App.exe"
[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.)
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
VersionInfoVersion={#MyAppVersion}
AllowNoIcons=yes
OutputDir=.\Deployment
OutputBaseFilename=App-Setup
SetupIconFile=.\Component\App.ico
Compression=lzma
SolidCompression=yes
WizardImageFile=.\Component\App.bmp
WizardSmallImageFile=.\Component\App.bmp
[Languages]
Name: "en"; MessagesFile: "compiler:Default.isl";
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files]
Source: ".\Component\Cal\*"; DestDir: "{app}\Cal"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\Component\Documentation\*"; DestDir: "{app}\Documentation"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\Component\Softwares\Utility\*"; DestDir: "{app}\Utility"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\Component\Softwares\System32\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: ".\Component\Softwares\App\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: ".\Component\Drivers\Keithley Driver\*"; Flags: deleteafterinstall createallsubdirs recursesubdirs; DestDir: "{tmp}";
Source: ".\Component\Drivers\Spec Driver\driver.exe"; DestDir: "{tmp}"; Check: Is64BitInstallMode;
Source: ".\Component\Drivers\Adaptater\adaptater.exe"; DestDir: "{tmp}"; Check: Is64BitInstallMode;
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
I: Integer;
begin
// CurStep values
// ssInstall, ssPostInstall, ssDone
MsgBox('Hello.', mbInformation, MB_OK);
if CurStep = ssPostInstall then begin
Exec(ExpandConstant('{tmp}\Keithley Driver\setup.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
Exec(ExpandConstant('{tmp}\driver.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
// Ask the user a Yes/No question
if MsgBox('Do you need to use the Adaptater?', mbConfirmation, MB_YESNO) = IDYES then
begin
Exec(ExpandConstant('{tmp}\adaptater.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
MsgBox('Please, plug it now!', mbInformation, MB_OK);
for I := 0 to 10 do
begin
Sleep(400);
end;
end;
end;
end;
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
更新3: 这是我最后的[Code]部分,用于安装具有依赖项的驱动程序:
[Files]
Source: ".\Component\Drivers\*"; Flags: deleteafterinstall createallsubdirs recursesubdirs; DestDir: "{tmp}";
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
I: Integer;
begin
// CurStep values
// ssInstall, ssPostInstall, ssDone
if CurStep = ssPostInstall then begin
Exec(ExpandConstant('{tmp}\Keithley Driver\setup.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
Exec(ExpandConstant('{tmp}\Driver\driver.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
// Ask the user a Yes/No question
if MsgBox('Do you need to use the Adaptater?', mbConfirmation, MB_YESNO) = IDYES then
begin
Exec(ExpandConstant('{tmp}\Adaptater\adaptater.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
MsgBox('Please, plug it now!', mbInformation, MB_OK);
for I := 0 to 10 do
begin
Sleep(400);
end;
end;
end;
end;
Thanx很多Rik!
答案 0 :(得分:2)
如果目的地已经是{tmp},我不知道你为什么要打{{1}}。
我认为这就足够了(注意源代码中的通配符和ExtractTemporaryFile('setup.exe');
):
deleteafterinstall
如果您在源代码行中有[Files]
Source: ".\Component\Drivers\Keithley Driver\*"; Flags: deleteafterinstall createallsubdirs recursesubdirs; DestDir: {tmp}
[Code]
Exec(ExpandConstant('{tmp}\setup.exe'), '-install "' + ExpandConstant('{tmp}') + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
标志,我认为您只会使用ExtractTemporaryFile()
。然后将不提取该文件,您可以在代码中手动执行该操作。没有dontcopy
- 标志你不需要它。
您的dontcopy
细分也未完整。
这是一个工作的小例子.iss:
[code]
您的文件仅位于ssPostInstall阶段的{tmp}目录中(并且在ssInstall阶段不)。