inno-setup – 如何使用Inno Setup更改可执行文件权限?

前端之家收集整理的这篇文章主要介绍了inno-setup – 如何使用Inno Setup更改可执行文件权限?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我通过InnoIDE中的向导创建了一个非常简单的inno脚本.但是,部署的可执行文件可以由普通用户运行.如何强制用户必须通过脚本以管理员身份运行它?
[Setup]
AppId={{03E6645E-2C53-4E90-967B-D0833A8EBDAF}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputBaseFilename=setup
Compression=lzma
SolidCompression=yes
Privilegesrequired=admin

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "                {cm:AdditionalIcons}"; Flags: unchecked

[Files]
Source: "C:\Program Files\Inno Setup 5\Examples\MyProg.exe"; DestDir: {app}; Flags: ignoreversion; Permissions: admins-readexec; 
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

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

[Run]
Filename: {app}\{#MyAppExeName}; Description: "{cm:LaunchProgram,{#StringChange(MyAppName,'&','&&')}}"; Flags: nowait postinstall skipifsilent;

解决方法

您无法使用Inno更改应用程序的权限或清单.

要使您的应用程序要求管理员权限,您需要向其添加适当的清单.这对于每种不同的编程语言都是不同的,但已经有人问过并回答了many related questions.

原文链接:https://www.f2er.com/delphi/103084.html

猜你在找的Delphi相关文章