如何在批處理文件中請求管理員訪問權限 - 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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章