我通过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.