visual-c++inno-setupvcredist

VC++ Redist install passively without restart always restarting


I'm trying to install VC++ Redist without any user input using the following code. I do not want system restart as well – so supplied /norestart flag

https://learn.microsoft.com/en-us/cpp/windows/redistributing-visual-cpp-files#command-line-options-for-the-redistributable-packages

[Run]
Filename: "{tmp}\VC_redist.x64.exe"; \
    Parameters: "/passive /Q:a /c:""msiexec /qb /norestart /i vcredist.msi"" "; \
    StatusMsg: Installing VC++ RunTime...

But after the install, the setup tries to restart the machine automatically


Solution

  • The VC++ Redist probably schedules some files to be replaced after next restart. Inno Setup detects that and restarts the computer after it finishes.

    You can disable Inno Setup from detecting this using RestartIfNeededByRun directive:

    When set to yes, and a program executed in the [Run] section queues files to be replaced on the next reboot (by calling MoveFileEx or by modifying wininit.ini), Setup will detect this and prompt the user to restart the computer at the end of installation.