【问题标题】:Execute postinstall program with administrator privileges in Inno Setup在 Inno Setup 中以管理员权限执行安装后程序
【发布时间】:2020-06-11 13:03:48
【问题描述】:

我正在尝试在安装结束时运行另一个安装程序 (postinstall)。安装程序需要管理员权限。所以添加了PrivilegesRequired=admin,但错误仍然存​​在。

错误信息如下:

无法执行文件:
C:\Users\User1\AppData\Local\Multi Webcam Video Recorder\webcam.exe

创建过程失败;代码 740.
请求的操作需要提升。

#define MyAppName "Multi Webcam Video Recorder"
#define MyAppExeName "webcam.exe"

[Setup]
AppName={#MyAppName}
PrivilegesRequired=admin

[Files]
Source: ..\src\webcam.exe; DestDir: {localappdata}\{#MyAppName}; Flags: ignoreversion

[Run]
Filename: {localappdata}\{#MyAppName}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#MyAppName}}; Flags: nowait postinstall skipifsilent

【问题讨论】:

    标签: installation inno-setup elevated-privileges


    【解决方案1】:

    使用postinstall flag,程序默认以原始权限执行,即使安装程序本身以管理员权限运行。要保留安装程序的(管理员)权限,请添加runascurrentuser flag

    [Run]
    Filename: {localappdata}\{#MyAppName}\{#MyAppExeName}; \
        Description: {cm:LaunchProgram,{#MyAppName}}; \
        Flags: nowait postinstall skipifsilent runascurrentuser
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-10-24
      • 1970-01-01
      • 2015-05-21
      • 1970-01-01
      • 2020-06-04
      • 2012-01-29
      • 2017-02-23
      • 1970-01-01
      相关资源
      最近更新 更多