Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :: Save as DNSswitch.cmd and put it on your desktop. This will toggle switching between default/dynamic DNS from your Internet Provider
- :: OR the ones you fill in below.
- @ECHO off
- :: CHANGE THE ADDRESSES! FIGURE OUT THE FASTEST DNS FOR YOU BY RUNNING THE NAMEBENCH TOOL!
- :: (GOOGLE IT, DOWNLOAD IT, RUN IT AND WAIT FOR ITS RECOMMMENDATIONS)
- SET PrimaryDNS=193.67.79.39
- SET SecondaryDNS=208.67.222.222
- :: Create the notification message; Closed internet, intranet enabled
- echo set WshShell = WScript.CreateObject("WScript.Shell") > %tmp%\tmp0.vbs
- echo WScript.Quit (WshShell.Popup( "LIMITED internet with FULL INTRANET" ,2 ,"Click OK", 0)) >> %tmp%\tmp0.vbs
- :: Create the notification message; Fast, open internet enabled, intranet disabled
- echo set WshShell = WScript.CreateObject("WScript.Shell") > %tmp%\tmp1.vbs
- echo WScript.Quit (WshShell.Popup( "OPEN internet with LIMITED INTRANET" ,2 ,"Click OK", 0)) >> %tmp%\tmp1.vbs
- :: Switch from automatic DNS via your network's DHCPserver to Manual or vice versa for all network adapters (wifi and cable)
- netsh interface ip show config | findstr /i "%PrimaryDNS%"
- if %ERRORLEVEL% EQU 1 (
- for /f "skip=2 tokens=3*" %%i in ('netsh interface show interface') do (
- netsh int ip set dns "%%j" static "%PrimaryDNS%" primary >nul 2>&1
- netsh int ip add dns "%%j" "%SecondaryDNS%" index=2 >nul 2>&1
- net use /DELETE M:
- net use /DELETE N:
- net use /DELETE O:
- net use /PERSISTENT:YES M: \\10.81.152.36\omgData
- net use /PERSISTENT:YES N: \\10.81.152.195\phddata
- net use /PERSISTENT:YES O: \\10.81.152.195\omddata
- )
- ) else (
- for /f "skip=2 tokens=3*" %%i in ('netsh interface show interface') do (
- netsh int ip set dns "%%j" dhcp >nul 2>&1
- )
- )
- :: Display a notification of the change that has been made
- netsh interface ip show config | findstr /i "%PrimaryDNS%"
- if %ERRORLEVEL% EQU 1 (
- cscript /nologo %tmp%\tmp0.vbs
- ) else (
- cscript /nologo %tmp%\tmp1.vbs
- )
- :: Flush DNS
- ipconfig /flushdns
- :: Cleanup the notification message files
- DEL /F /S /Q /A %tmp%\tmp0.vbs
- DEL /F /S /Q /A %tmp%\tmp1.vbs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement