(转载自: http://lishirongandcto.blog.163.com/blog/static/17727608020136444757944/ 2013-07-04 )
废话不多说,直接上代码:
---------------------------------------------------------------------------------------
@ echo off
%1 %2
ver|find "5.">nul&&goto :st
mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :st","","runas",1)(window.close)&goto :eof
:st
copy "%~0" "%windir%\system32\"
netsh wlan start hostednetwork
----------------------------------------------------------------------------------------
说明:将分割线中间的代码保存为“你的名字.bat",如”run.bat",那么双击就可以直接以管理员身份运行该bat文件了
该bat文件从最后一行算是真正开始,前面都是取得权限,本例中只运行了一句代码"netsh wlan start hostednetwork".
时间: 2024-11-08 18:11:12