如何使用Inno Setup更改可执行文件的权限? [英] How to change executable file rights using Inno Setup?

查看:124
本文介绍了如何使用Inno Setup更改可执行文件的权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过InnoIDE中的向导创建了一个非常简单的inno脚本.但是,已部署的可执行文件可以由普通用户运行.如何强制用户必须通过脚本以管理员身份运行它?

I have created a very simple inno script through a wizard in InnoIDE. However the deployed executable file can be run by normal user. How can I enforce that the user has to run it as administrator through the script ?

[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来更改应用程序的权限或清单.

You can't use Inno to change the permissions or manifest of your application.

要使您的应用程序要求管理员权限,您需要向其添加适当的清单.每种不同的编程语言都不同,但是许多相关问题已经存在被要求和回答.

To make your application ask for admin permissions, you will need to add the appropriate manifest to it. This is different for each different programming language but many related questions have already been asked and answered.

这篇关于如何使用Inno Setup更改可执行文件的权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆