:Execute the command as an administrator
:
@echo on
>nul 2>&1 "%SYSTEMROOT%system32cacls.exe" "%SYSTEMROOT%system32configsystem"
if '%errorlevel%' NEQ '0' (
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%getadmin.vbs"
echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%getadmin.vbs"
"%temp%getadmin.vbs"
exit /B
:gotAdmin
if exist "%temp%getadmin.vbs" ( del "%temp%getadmin.vbs" )
:Execution script information
route add 172.0.0.0 mask 255.0.0.0 192.168.2.234
双击即可,不过在Windows10上面还是会弹出确认以下信息点击确认即可。此脚本省去了右键点击选择以管理员运行的操作