在 Inno Setup 中以管理员权限执行安装后程序
Execute postinstall program with administrator privileges in Inno Setup
我正在尝试 运行 安装结束时的另一个安装程序 (postinstall
)。安装程序需要管理员权限。所以添加了 PrivilegesRequired=admin
但错误仍然存在。
错误信息如下:
Unable to execute file:
C:\Users\User1\AppData\Local\Multi Webcam Video Recorder\webcam.exe
CreateProcess failed; code 740.
The requested operation requires elevation.
#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
与postinstall
flag, the program is by default executed with original permissions, even if the installer itself is running with Administrator permissions. To keep the (Administrator) permissions of the installer, add runascurrentuser
flag:
[Run]
Filename: {localappdata}\{#MyAppName}\{#MyAppExeName}; \
Description: {cm:LaunchProgram,{#MyAppName}}; \
Flags: nowait postinstall skipifsilent runascurrentuser
我正在尝试 运行 安装结束时的另一个安装程序 (postinstall
)。安装程序需要管理员权限。所以添加了 PrivilegesRequired=admin
但错误仍然存在。
错误信息如下:
Unable to execute file:
C:\Users\User1\AppData\Local\Multi Webcam Video Recorder\webcam.exeCreateProcess failed; code 740.
The requested operation requires elevation.
#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
与postinstall
flag, the program is by default executed with original permissions, even if the installer itself is running with Administrator permissions. To keep the (Administrator) permissions of the installer, add runascurrentuser
flag:
[Run]
Filename: {localappdata}\{#MyAppName}\{#MyAppExeName}; \
Description: {cm:LaunchProgram,{#MyAppName}}; \
Flags: nowait postinstall skipifsilent runascurrentuser