Visual c++ 如何完成Installation ant然后重新启动windows?

Visual c++ 如何完成Installation ant然后重新启动windows?,visual-c++,inno-setup,Visual C++,Inno Setup,我尝试重新编写现有的inno安装脚本,并对其包含一些依赖项。但在安装过程中,VC++可再发行版始终重新启动windows,而不是从安装向导窗口。这次重启完全破坏了所有的安装进度。我有这个剧本 [Files] Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Launcher\AAC Psychologue.exe"; DestDir: "{app}"; Flags: ignoreversion

我尝试重新编写现有的inno安装脚本,并对其包含一些依赖项。但在安装过程中,VC++可再发行版始终重新启动windows,而不是从安装向导窗口。这次重启完全破坏了所有的安装进度。我有这个剧本

[Files]
    Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Launcher\AAC Psychologue.exe"; DestDir: "{app}"; Flags: ignoreversion
    Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Launcher\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
    Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Resources\dxwebsetup.exe"; DestDir: "{app}"; AfterInstall: DirecXinstaller; Flags: ignoreversion deleteafterinstall
    Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Resources\Windows6.1-KB2670838-x64.msu"; DestDir: "{app}"; Flags: 64bit deleteafterinstall
    Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Resources\Windows6.1-KB2670838-x86.msu"; DestDir: "{app}"; AfterInstall: Win7Update; Flags: 32bit deleteafterinstall
    Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Resources\Windows6.1-KB2670838-x86.msu"; DestDir: "{app}"; AfterInstall: Win7Update; Flags: 32bit deleteafterinstall
    Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Resources\vc_redist.x86.exe"; DestDir: "{app}";AfterInstall: vcInstaller; Flags: 32bit deleteafterinstall
    Source: "E:\engine\repos\AACPsychologue_all\aacpsychologue\Installers\Resources\vc_redist.x64.exe"; DestDir: "{app}";AfterInstall: vcInstaller; Flags: 64bit deleteafterinstall

    ; NOTE: Don't use "Flags: ignoreversion" on any shared system files

    [Icons]
    Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"      
    Name: "{commondesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}";

    [Code]

    procedure DirecXinstaller;
    var
      ResultCode: Integer;
    begin
      if not Exec(ExpandConstant('{app}\dxwebsetup.exe'), '', '', SW_SHOWNORMAL,
        ewWaitUntilTerminated, ResultCode)
      then
        MsgBox('Other installer failed to run!' + #13#10 +
          SysErrorMessage(ResultCode), mbError, MB_OK);
    end;


    procedure Win7Update;
    var
      ResultCode: Integer;
    begin
      if IsWin64 then
      begin
        Exec(ExpandConstant('{app}\Windows6.1-KB2670838-x64.msu'), '', '', SW_SHOWNORMAL,
        ewWaitUntilTerminated, ResultCode)
      end
      else
      begin
        Exec(ExpandConstant('{app}\Windows6.1-KB2670838-x86.msu'), '', '', SW_SHOWNORMAL,
        ewWaitUntilTerminated, ResultCode)
      end;
    end;

    procedure vcInstaller;
    var
      ResultCode: Integer;
    begin
      if IsWin64 then
        begin
          Exec(ExpandConstant('{app}\vc_redist.x64.exe'), '', '', SW_SHOWNORMAL, ewNoWait, ResultCode)
        end
      else
        begin
          Exec(ExpandConstant('{app}\vc_redist.x86.exe'), '', '', SW_SHOWNORMAL, ewNoWait, ResultCode)
        end;
    end;


    [Run]
    Filename: "{app}\{#MyAppExeName}"; Flags: postinstall skipifsilent waituntilterminated unchecked;

有什么想法吗?

vc\u redist.*.exe
/norestart
开关以防止重新启动

然后,您可以使用使Inno安装程序重新启动计算机


另外,请注意,最好使用
[Run]
部分来执行子安装程序。此外,将临时文件安装到
{app}
不是一个好做法。我也不认为您想要使用
ewNoWait

[设置]
AlwaysRestart=是
[档案]
来源:“…\vc_redist.x86.exe”;DestDir:“{tmp}”;标志:32位
来源:“…\vc_redist.x64.exe”;DestDir:“{tmp}”;标志:64位
[运行]
文件名:“{tmp}\vc_redist.x86.exe”;参数:“/norestart”;标志:32位
文件名:“{tmp}\vc_redist.x64.exe”;参数:“/norestart”;标志:64位

vc_redist.*.exe
具有
/norestart
开关以防止重新启动

然后,您可以使用使Inno安装程序重新启动计算机


另外,请注意,最好使用
[Run]
部分来执行子安装程序。此外,将临时文件安装到
{app}
不是一个好做法。我也不认为您想要使用
ewNoWait

[设置]
AlwaysRestart=是
[档案]
来源:“…\vc_redist.x86.exe”;DestDir:“{tmp}”;标志:32位
来源:“…\vc_redist.x64.exe”;DestDir:“{tmp}”;标志:64位
[运行]
文件名:“{tmp}\vc_redist.x86.exe”;参数:“/norestart”;标志:32位
文件名:“{tmp}\vc_redist.x64.exe”;参数:“/norestart”;标志:64位