如何在批处理文件中请求管理员访问权限 - How to request Administrator access inside a batch file

问题:

I am trying to write a batch file for my users to run from their Vista machines with UAC.我正在尝试为我的用户编写一个批处理文件,以便使用 UAC 从他们的 Vista 机器上运行。 The file is re-writing their hosts file, so it needs to be run with Administrator permissions.该文件正在重写其主机文件,因此需要以管理员权限运行。 I need to be able to send them an email with a link to the .bat file.我需要能够向他们发送一封电子邮件,其中包含指向 .bat 文件的链接。 The desired behavior is that when they right-click on the file and say Open, they will get one of those UAC dialogs that makes the screen go dark and forces them to answer whether they want to give the application permission to run as administrator.所需的行为是,当他们右键单击文件并说“打开”时,他们将获得使屏幕变暗并强制他们回答是否要授予应用程序以管理员身份运行的权限的那些 UAC 对话框之一。 Instead, they are just seeing "Access denied" on the command line window.相反,他们只是在命令行窗口中看到“拒绝访问”。

Is this possible to do differently?这有可能以不同的方式做吗?


解决方案:

参考一: https://en.stackoom.com/question/7wxz
参考二: https://stackoom.com/question/7wxz
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章