問題:
How do I check if the current batch script has admin rights?如何檢查當前批處理腳本是否具有管理員權限?
I know how to make it call itself with runas but not how to check for admin rights.我知道如何使用 runas 調用它自己,但不知道如何檢查管理員權限。 The only solutions I've seen are crude hack jobs or use external programs.我見過的唯一解決方案是粗略的黑客工作或使用外部程序。 Well, actually I don't care if it is a hack job as long as it works on Windows XP and newer.好吧,實際上我不在乎它是否是黑客工作,只要它適用於 Windows XP 和更新版本即可。
解決方案:
參考一: https://stackoom.com/question/H04x參考二: Batch script: how to check for admin rights