gpt4 book ai didi

installation - 在 Inno Setup 中以管理员权限执行安装后程序

转载 作者:行者123 更新时间:2023-12-05 02:56:33 26 4
gpt4 key购买 nike

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

错误信息如下:
enter image description here

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 ,程序默认以原始权限执行,即使安装程序本身以管理员权限运行。要保留安装程序的(管理员)权限,请添加 runascurrentuser flag :

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

如果主安装程序没有管理员权限,请参阅:
Execute postinstall program (sub installer) with administrator privileges in Inno Setup even if the main installer does not have them

关于installation - 在 Inno Setup 中以管理员权限执行安装后程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60434553/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com