%1 start "" mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
这句命令写在脚本开头,这样运行后可提权让脚本以管理员身份运行。
其实和在脚本上右键选择以管理员身份运行一个道理。