2013-06-01 348 views
1

我想运行在安装之前的应用程序,我使用的是Inno Setup的脚本(帕斯卡)此代码之前运行的exe:Inno Setup的脚本安装

function InitializeSetup():boolean; 
var 
    ResultCode: integer; 
begin 

// Launch Notepad and wait for it to terminate 
if ExecAsOriginalUser('{src}\MyFolder\Injector.exe', '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then 
begin 
// handle success if necessary; ResultCode contains the exit code 
end 
else begin 
    // handle failure if necessary; ResultCode contains the error code 
end; 

// Proceed Setup 
    Result := True; 

end; 

当我使用“{赢} \ notepad.exe“,它可以工作,但是当我使用”{src} \ MyFolder \ Injector.exe“时,安装程​​序不会打开我的程序并继续安装。

注意:喷油器有app.manifest有'requireAdministrator'。但是这个应用程序应该以管理员身份运行

那么,怎么了?

+0

我将我的应用程序复制/粘贴到桌面,当我使用这个:'C:\ Users \ Oceanjack \ Desktop \ Injector.exe'时,它不起作用。 –

回答

3

在代码中使用诸如{src}等值时,您需要使用ExpandConstant函数。

但是,InitializeSetup运行安装任务还为时尚早。您应该将此代码移至CurStepChanged(ssInstall)

另外,如果需要管理员权限,则必须使用Exec而不是ExecAsOriginalUser运行。

1

这可能为你工作。我相信这个问题是因为在整个path..that空间应该用双引号路径克服...

Exec('cmd.exe','/c "'+ExpandConstant('{src}\MyFolder\Injector.exe')+'"', '',SW_SHOW,ewWaitUntilTerminated, ResultCode); 

欢呼声..

相关问题