Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
437 views
in Technique[技术] by (71.8m points)

elevated privileges - How to set 'Run as administrator' on a file using Inno Setup

I'm creating an installer using Inno Setup. As part of the install process I'm installing Tomcat. On Windows 7 I suffer from the problem described here:

http://blog.paulbouwer.com/2010/10/23/the-case-of-the-annoying-tomcat-6-monitor/

I can fix it by manually setting the 'Run as administrator' on tomcat7w.exe (the issue and the root cause is the same for tomcat7 as well), but I don't know how to do it through Inno Setup.

I'm finding threads that explain running some_program.exe as administrator, but here the program is started when the Tomcat service starts (e.g. on machine start-up), so I need a way to flag it using Inno Setup to 'Run as administrator' rather than actually run it.

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can add a Registry entry in [Registry] Section that will set run as Administrator as a default action for running this app.

Example:

Root: "HKLM"; Subkey: "SOFTWAREMicrosoftWindows NTCurrentVersionAppCompatFlagsLayers"; 
    ValueType: String; ValueName: "{app}omcat7w.exe"; ValueData: "RUNASADMIN"; 
    Flags: uninsdeletekeyifempty uninsdeletevalue; MinVersion: 0,6.1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...