Description
Everything you need in network tools all in one utility.
Constatnly monitor IP Addresses
IPconfig
Speed test
Watch IP address
Network adapters
Ping
DNS test
and much more…
Source Code
@echo off
:start
cls
Title Network Utilities
color 0A
mode 60,40
cd /d %~dp0
echo %computername%
for /f "tokens=1-2 delims=:" %%a in ('ipconfig^|find "IPv4"') do set ip=%%b
set ip=%ip:~1%
echo My IP: %ip%
Title %ip%
for /f "tokens=1-2 delims=:" %%a in ('ipconfig^|find "Gateway"') do set gw=%%b
set gw=%gw:~1%
echo My Gateway: %gw%
ping -n 1 www.google.com >nul
if errorlevel 1 (cls&echo Failed&pause>nul&exit)
echo My Internet is working!
for /f %%a in ('powershell Invoke-RestMethod api.ipify.org') do set PublicIP=%%a
echo WAN IP: %PublicIP%
set userinp= 2
echo.&echo Select one: (RUN AS ADMINISTRATOR)
echo =======================================
echo w Watch IP addresses (loop test connection)
echo R Repair Network Connection
echo r IP Address flush n renew (ipconfig /release /renew)
echo f DNS flush and renew (ipconfig /flushDNS /registerdns)
echo t Troubleshoot connection
rem echo l List all SERVERS connected
rem echo L List all Devices in this IP range
rem echo g List Gateway address
echo s List Network settings
echo =======================================
echo 2 Network information (ipconfig /all)
echo 1 IP Address (ARP Address Resolution MAC)
echo n List IP address used (Netstat -an)
echo a Flush ARP and renew
rem echo 3 Server names NSlookup (exit) (obsolete)
rem echo 4 IP address ranges Nbtstat (obsolete)
echo 5 DNS Test
echo 6 DNS Test (For domains)
echo 7 DNS table and connections
echo 8 MAC address Getmac
echo 9 Update group policies (gpupdate)
echo =======================================
echo 0 TraceRoute
echo d Test DNS servers
echo S Speed test to Google
rem echo h Hosts file display
echo H Host file EDIT
echo c Command Prompt (cmd.exe)
echo b restart this menu
rem echo z to test code
echo q to quit
echo ======================================
set /p userinp= Choose a number or letter:
REM can only go to 9
set userinp=%userinp:~0,1%
rem ========================
if "%userinp%"=="1" goto arp
if "%userinp%"=="2" goto configall
if "%userinp%"=="3" goto nslookup
if "%userinp%"=="4" goto nbstat
if "%userinp%"=="5" goto testdns
if "%userinp%"=="6" goto testdomain
if "%userinp%"=="7" goto dnstable
if "%userinp%"=="8" goto getmac
if "%userinp%"=="9" goto gpupdate
if "%userinp%"=="0" goto trace
if "%userinp%"=="-" goto tracert
if "%userinp%"=="a" goto flusharp
if "%userinp%"=="f" goto flushdns
if "%userinp%"=="c" goto cmd
if "%userinp%"=="r" goto renew
if "%userinp%"=="R" goto repair
if "%userinp%"=="d" goto dns
if "%userinp%"=="s" goto netset
if "%userinp%"=="S" goto speed
if "%userinp%"=="n" goto network
if "%userinp%"=="h" goto hosts
if "%userinp%"=="H" goto hostsedit
if "%userinp%"=="g" goto gateway
if "%userinp%"=="t" goto troubleshoot
if "%userinp%"=="L" goto listd
if "%userinp%"=="l" goto listc
if "%userinp%"=="w" goto watch
if "%userinp%"=="z" goto test
if "%userinp%"=="b" goto start
if /I "%userinp:~0,1%"=="q" goto exit
IF "%userinp%"=="" (ECHO Nothing is entered&pause
GoTo :start)
echo Invalid choice
pause&cls&goto start
rem ========================
:arp
cls
echo.&echo.&echo Listing all address in the ARP
arp -a
pause&cls&goto start
rem ========================
:configall
cls
echo.&echo.&echo.
ipconfig
pause&cls&goto start
rem ========================
:nslookup
cls
echo.&echo.&echo.
nslookup
pause&cls&goto start
rem ========================
:nbstat
cls
echo.&echo.&echo.
nbtstat -rr
nbtstat -c
pause&cls&goto start
rem ========================
:testdns
Title Testing domain Connection
cls
echo Enter a computer name and the IP should display.
echo Enter a IP address and The Computer name should display.
set /p server=Enter the ip address of the server:
echo Testing my server and domain
ping -n 1 %userdomain%
REM enter your server(s) name below
ping -n 1 %server%
echo.
echo==============
echo Testing Extrnal DNS
ping -n 1 google.com
ping -n 1 yahoo.com
echo.
pause&cls&goto start
rem ========================
:testdomain
cls
Title Testing domain Connection
et /p server=Enter the ip address of the server:
echo Testing my server and domain
ping -n 1 %userdomain%
REM enter your server(s) name below
ping -n 1 %server%
echo.
echo==============
echo Testing Extrnal DNS
ping -n 1 google.com
ping -n 1 yahoo.com
echo.
echo=============
echo Testing server
REM enter your server ip address below (replace 0.200)
nslookup 127.0.0.1 192.168.0.200
echo.
echo==============
echo testing this computer's registration
nslookup %Computername%.%UserDomain%.lan
pause&cls&goto start
rem ========================
:gpupdate
cls
gpupdate /force
echo========
echo Open gpreport.html from your desktop
pause
rem ========================
:report
gpresult /h gpreport.html
start explorer gpreport.html
pause&cls&goto start
rem ========================
:dnstable
cls
echo.&echo.&echo.
ipconfig /displaydns
pause
echo ===netsh dnsclient show state
netsh dnsclient show state
pause
Echo ===netsh namespace show effectivepolicy
netsh namespace show effectivepolicy
pause&cls&goto start
rem ========================
:getmac
cls
echo.&echo.&echo.
getmac
pause&cls&goto start
rem ========================
:trace
cls
set trace= %gw%
echo.&echo.&echo.
echo Enter IP address to trace
SET /P address= Gateway will be used by default:
cls&echo.&echo.&echo Tracing %trace%
Title tracing %trace%
tracert -w 5 %trace%
pause&cls&goto start
rem ========================
:tracert
cls
echo.&echo.&echo.
echo.&echo.&echo tracing google.com
tracert -w 5 google.com
pause&cls&goto start
rem ========================
:flusharp
cls
echo.&echo.&echo You pressed a for flusing arp table
echo Flushing arp (arp -d -a)
arp -d -a
netsh interface ip delete arpcache
pause&cls&goto start
rem ========================
:setDNS
cls
echo.&echo.&echo You pressed D Changing DNS to Google
echo.&echo Changing IPV4 primary DNS
netsh interface ipv4 set dns name="Local Area Connection" static 8.8.4.4 primary
echo Changing IPV4 DNS 2
netsh interface ipv4 add dns name="Local Area Connection" 8.8.8.8 index=2
echo.&echo.&echo if you wish to revert to default DNS server goto network adapter settings
echo and select Use default DNS servers
pause&cls&goto start
rem ========================
:flushdns
cls
echo.&echo.&echo You pressed f for flush DNS
echo Flushing DNS (ipconfig /flush DNS) and restarting service
net stop dnscache
net start dnscache
ipconfig /flushDNS
ipconfig /renew
ipconfig /registerdns
pause&cls&goto start
rem ========================
:renew
cls
echo.&echo.&echo RENEWING IP ADDRESS
Title RENEWING IP ADDRESS
echo.&echo If you receive an error check the IP is not fixed
timeout /t 5
REM stopping network services
ipconfig /release
ipconfig /release6
REM netsh winsock reset
REM netsh winsock reset catalog
REM netsh int ip reset resetlog.txt
REM netsh winhttp reset proxy
REM net stop wwansvc
REM net stop wlansvcN
REM net stop dot3svc
REM net stop DHCP
REM net stop netman
timeout /t 5
cls
echo RENEWING IP ADDRESS
REM net start wwansvc
REM net start wlansvc
REM net start dot3svc
REM net start DHCP
REM net start netman
ipconfig /renew
REM ipconfig /renew6
pause&cls&goto start
rem ========================
:Repair
cls
echo.&echo.&echo You pressed r for renew
REM stopping network services
ipconfig /release
ipconfig /release6
ipconfig /flushdns
netsh winsock reset
netsh winsock reset catalog
netsh int ip reset resetlog.txt
netsh winhttp reset proxy
net stop wwansvc
net stop wlansvc
net stop dot3svc
net stop DHCP
net stop netman /y
timeout /t 5
cls
echo Renewing IP address
net start wwansvc
net start wlansvc
net start dot3svc
net start DHCP
net start netman
ipconfig /renew
ipconfig /renew6
ipconfig /registerdns
pause&cls&goto start
rem ========================
:cmd
cls
echo.&echo.&echo You pressed D for Dos prompt
start cmd.exe
cls&goto start
rem ========================
:netset
cls
echo.&echo.&echo You pressed N for network connections
control netconnections
cls&goto start
rem ========================
:network
cls&echo.&echo.&echo Listing network adresses
ipconfig
pause&cls&goto start
rem ========================
:myip
REM for /f "delims=[] tokens=2" %%a in ('ping %computername% -n 1 ^| findstr "["') do (set thisip=%%a)
REM echo %thisip%
ipconfig | findstr /R /C:"IP.* Address"
rem ========================
REM getgateway
@For /f "tokens=3" %%* in (
'route.exe print ^|findstr "\<0.0.0.0\>"'
) Do @Set "DefaultGateway=%%*
echo.&echo Gateway address..................%defaultgateway%
pause&cls&goto start
rem ========================
:hosts
cls&echo.&echo.&echo.
takeown /f "%windir%\system32\drivers\etc\hosts" && icacls "%windir%\system32\drivers\etc\hosts" /grant administrators:F
attrib -s -h -r %windir%\system32\drivers\etc\hosts
%windir%\notepad.exe %windir%\system32\drivers\etc\hosts
REM start notepad "a:\Lynnskeys.txt"
pause&cls&goto start
rem ========================
:hostsedit
start hostseditor.exe
pause&cls&goto start
rem ========================-
:gateway
echo Displaying gateway
REM # Define a temp variable 'DefaultGateway'
@For /f "tokens=3" %%* in (
'route.exe print ^|findstr "\<0.0.0.0\>"'
) Do @Set "DefaultGateway=%%*"
cls
echo.& echo Gateway address is- %defaultgateway%
pause&cls&goto start
rem ========================
:troubleshoot
cls
echo Troubleshooting connection
REM goto pinging
:findgateway
REM # Set varible for gateway
echo.
echo.
REM # Define a temp variable 'DefaultGateway'
@For /f "tokens=3" %%* in (
'route.exe print ^|findstr "\<0.0.0.0\>"'
) Do @Set "DefaultGateway=%%*
echo.
echo Testing network card
Title Testing network card
@ping 127.0.0.1 > nul
@IF ERRORLEVEL 1 GOTO netcardfail
REM @IF ERRORLEVEL 0 GOTO alive
echo.
echo.
echo Network card is ok
timeout /t 2
cls
echo.
echo.
echo Testing connection to your router/Internet box
Title Testing connection to your router and Internet box
@ping %defaultgateway% > nul
@IF ERRORLEVEL 1 GOTO routerconnect
REM @IF ERRORLEVEL 0 GOTO alive
echo.
echo.
echo Your Connection to your Wireless box or router is working
timeout /t 2
cls
echo.
echo.
echo Testing Internet connection
Title Testing Internet connection
rem ========================
:pinging
REM %windir%\System32\ping.exe 127.0.0.1
@ping www.yahoo.com > nul
REM pause
@IF ERRORLEVEL 1 GOTO internetfail
REM @IF ERRORLEVEL 0 GOTO alive
rem ========================
:alive
echo.
echo.
echo Your Internet connection is fine
timeout /t 2
cls
rem ========================
:passed
echo.
echo.
echo Everything passed!
Title Everything passed!
echo You have internet!
echo If your browser isn't work then your browser is broken or hijacked
echo Try another browser or scan your computer for malware.
pause&cls&goto start
rem ========================
:netcardfail
cls
color 0C
echo.
echo.
echo Your network card communication has failed!
echo Try another connection or usb network card.
pause&cls&goto start
rem ========================
:routerconnect
cls
color 0C
echo.
echo.
echo Your connection to your router failed!
echo This could be your cable or wireless connection
echo Power cycle your router and internet box and wait 2 minutes to test again
pause&cls&goto start
rem ========================
:internetfail
cls
color 0C
echo.
echo.
echo Your Internet connection failed!
echo This may be your internet is down or your
echo Router needs reset. Make sure you internet light on your
echo Internet box is on.
echo Power cycle your internet box and wait 2 minutes to test again.
echo
echo Delete network card driver, and reinstall
pause&cls&goto start
rem ========================
:listd
cls
echo Listing all Ip addresses in use ARP -a (Address Resolution)
for /f "usebackq delims= " %%i in (`net view ^| find "\\"`) do echo %%i
arp -a
pause&cls&goto start
rem ========================
:listc
cls
echo.&echo.&echo Listing all Computers Connected&echo.
setlocal EnableDelayedExpansion
set "xNext="
set "xComputer="
for /f %%A in ('net view /all') do (
set "xComputer=%%~A"
if "!xComputer:~0,2!"=="\\" for /f "tokens=2,* delims=. " %%X in ('nslookup %%A') do (
if "!xNext!"== "1" (
echo.!xComputer! = %%X.%%Y
set "xNext=0"
)
if "!xComputer:~2!"=="%%~X" set "xNext=1"
)
)
endlocal
pause&cls&goto start
rem ========================
:watch
set time=15
REM start "watchips.bat"
cls&echo.&echo.
rem echo Screen will refresh every %time% seconds
echo %computername%
for /f "tokens=1-2 delims=:" %%a in ('ipconfig^|find "IPv4"') do set ip=%%b
set ip=%ip:~1%
echo My IP: %ip%
title %ip%
for /f "tokens=1-2 delims=:" %%a in ('ipconfig^|find "Gateway"') do set gw=%%b
set gw=%gw:~1%
echo My Gateway: %gw%
ping -n 1 www.google.com >nul
if errorlevel 1 (cls&echo Failed&pause>nul&exit)
echo My internet is working!
rem goto loop
rem echo.&echo.&echo Watching these IP addresses until ESC key is pressed
rem echo (edit WATCH section to change or add addrresses)
rem echo.
echo.
echo This Computer &ping -n 1 127.0.0.1 -a -w 2 | FIND "TTL="
echo.
echo My Gateway &ping -n 1 %gw% -a -w 2 | FIND "TTL="
echo.
rem echo My Server &ping -n 1 192.168.0.200 -a -w 2 | FIND "TTL="
rem echo.
echo Google DNS &ping -n 1 8.8.4.4 -a -w 2 | FIND "TTL="
echo.
echo My Mail Server &ping -n 1 mail.secureserver.net -a -w 2 | FIND "TTL="
rem :loop
echo.
choice /T %time% /C yn /D y /M "Refresh every %time% seconds"
If Errorlevel 2 Goto start
goto watch
rem ========================
:DNS
cls
echo Testing DNS servers & cls
Title Testing DNS
echo.
set domainname=www.google.com
echo.
for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% ^| find /v "Aliases"') do set my_dns_result=%%a
cls&echo.&echo.&echo Testing DNS servers
for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 8.8.8.8 ^| find /v "Aliases"') do set google_result=%%a
cls&echo.&echo.&echo Testing DNS servers
for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 208.67.222.222 ^| find /v "Aliases"') do set OpenDNS_result=%%a
cls&echo.&echo.&echo Testing DNS servers
for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 216.146.35.35 ^| find /v "Aliases"') do set DynDNS_result=%%a
cls&echo.&echo.&echo Testing DNS servers
for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 198.153.192.50 ^| find /v "Aliases"') do set Norton_DNS_result=%%a
cls&echo.&echo.&echo Testing DNS servers
for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 8.26.56.26 ^| find /v "Aliases"') do set combo_result=%%a
cls&echo.&echo.&echo Testing DNS servers
for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 156.154.70.1 ^| find /v "Aliases"') do set DNS_Advantage_result=%%a
cls&echo.&echo.&echo Testing DNS servers
for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 4.2.2.2 ^| find /v "Aliases"') do set Verizon_result=%%a
cls&echo.&echo.&echo Testing DNS servers
for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 209.244.0.3 ^| find /v "Aliases"') do set Level3_result=%%a
cls&echo.&echo.&echo Testing DNS servers
for /f "skip=1 tokens=2 delims=: " %%a in ('nslookup %domainname% 195.46.39.39 ^| find /v "Aliases"') do set SafeDNS_result=%%a
cls&echo.&echo.&echo Testing DNS servers
cls
echo. && echo.
echo. Results from various DNS server for Domain %domainname%
echo.
echo. Searched for A-Record
echo. && echo. && echo.
echo Result from Your DNS Settings : %my_dns_result%
echo Result from Google DNS : %google_result%
echo Result from OpenDNS : %OpenDNS_result%
echo Result from Norton DNS : %Norton_DNS_result%
echo Result from Combo Secure DNS : %combo_result%
echo Result from DNS Advantage : %DNS_Advantage_result%
echo Result from Verizon : %Verizon_result%
echo Result from Level3 : %Level3_result%
echo Result from Safe DNS : %SafeDNS_result%
echo Result from DynDNS : %DynDNS_result%
echo.&echo.&echo.
rem ========================
:speed
cls
echo.&echo.&echo Testing connection Speeds &echo.
for /F "tokens=7 delims== " %%A in ('
ping -4 -n 1 google.com^|findstr /i "TTL="') do @echo Connection speed to Google.com: %%A
echo.&echo.&echo.
pause&cls&goto start
rem ========================
:test
cls
echo.&echo.&echo test code here&echo.
for /F "tokens=7 delims== " %%G in ('
ping -4 -n 1 google.com^|findstr /i "TTL="') do @echo %%G
pause&cls&goto start
rem ========================
:end
pause>nul
:exit
Screenshots
1 Spice up
Very useful script, like All-in-one. thanks a lot for sharing, mate.