-
Notifications
You must be signed in to change notification settings - Fork 0
/
resetdns.cmd
42 lines (35 loc) · 1.05 KB
/
resetdns.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
@echo off
cls
:initialization
setlocal DisableDelayedExpansion
set "filePath=%~0"
for %%i in (%0) do set fileName=%%~ni
set "getAdmin=%temp%\%fileName%.vbs"
setlocal EnableDelayedExpansion
:checkPrivileges
net file 1>nul 2>nul
if '%errorlevel%' == '0' ( goto gotAdminRights ) else ( goto getAdminRights )
:getAdminRights
if "%1" == "ELEV" (echo ELEV & shift /1 & goto gotAdminRights)
ECHO set UAC = CreateObject^("Shell.Application"^) > "%getAdmin%"
ECHO args = "ELEV " >> "%getAdmin%"
ECHO for each strArg in WScript.Arguments >> "%getAdmin%"
ECHO args = args ^& strArg ^& " " >> "%getAdmin%"
ECHO next >> "%getAdmin%"
ECHO UAC.ShellExecute "!filePath!", args, "", "runas", 1 >> "%getAdmin%"
"%SystemRoot%\System32\WScript.exe" "%getAdmin%" %*
exit /B
:gotAdminRights
setlocal & pushd .
cd /d %~dp0
if "%1" == "ELEV" (del "%getAdmin%" 1>nul 2>nul & shift /1)
:adminCMDs
ipconfig /flushdns
ipconfig /registerdns
ipconfig /release
ipconfig /renew
netsh winsock reset
echo This computer will restart...
pause
shutdown /r /t 00
cmd /k