启动时以管理员身份运行程序
我有一个信息亭应用程序,想在启动时运行它。这里的问题是,当我输入注册表值在启动时打开它时,它不会以管理员身份打开程序,因此该程序可能无法运行。我使用的是 Windows 7。任何人都可以帮助我编写以管理员身份运行它的代码吗?有些程序(例如反病毒和病毒本身)在启动时以管理员身份运行,而不要求用户接受以管理员身份运行,这正是我想要做的。非常感谢任何帮助。
I have a kiosk app and want to run it at startup. The problem here is that when I put Registry value to open it at startup, it doesn't open program as Administrator and so that program doesn't work probably. I'm using Windows 7. Can anyone help me with code to run it as Administrator? Some programs (such as anit-viruses and the viruses themselves) work as Administrator at startup WITHOUT ASKING THE USER TO ACCEPT RUNNING AS ADMINISTRATOR, that's exactly I want to do. Any help is very thanked.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要在启动时运行应用程序,您可以:
您的防病毒软件示例听起来像#2。
To run a application at startup, you can either:
Your example of the antivirus software sounds like #2.
您可以将程序设置为只能以管理员身份运行。
在 Visual Studio 中:
单击它后,将在项目的属性文件夹下创建一个名为 app.manifest 的文件,一旦创建,您可以取消选中
Enable ClickOnce 安全设置
选项打开该文件并将此行 : 更改
为:
这将使程序需要管理员权限,并且保证您有权访问该文件夹。
You can set the program so you can only run as administrator.
In Visual Studio:
After you clicked it, a file will be created under the Project's properties folder called app.manifest once this is created, you can uncheck the
Enable ClickOnce Security Settings
optionOpen that file and change this line :
to:
This will make the program require administrator privileges, and it will guarantee you have access to that folder.