一个网络检测工具
bat吧
全部回复
仅看楼主
level 14
TJUGERKFER 楼主
1L自古喂度娘233333333
2015年09月29日 09点09分 1
level 14
TJUGERKFER 楼主
为水经验贴源码
@echo off
title 网络测试助手
del /a /s /f /q %temp%\报告.txt>nul 2>nul
del /a /s /f /q %temp%\报告2.txt>nul 2>nul
echo 本工具可以判断网络各种故障 按任意键开始
pause>nul
title 网络测试助手 -正在检测
echo 正在检测
ping 114.114.114.114>>%temp%\报告.txt
if %errorlevel%==0 echo 您的网络貌似是正常的,开始下一步检测
if %errorlevel%==1 echo 您的网络貌似不通,开始下一步检测
if %errorlevel%==9009 echo cmd废了,相当于“‘ping’不是内部或外部命令”那啥的。关闭吧。
find "传输失败" %temp%\报告.txt>nul
if %errorlevel%==0 goto err1
find "访问超时" %temp%\报告.txt>nul
if %errorlevel%==0 goto err2
find "无法联系 IP 驱动程序" %temp%\报告.txt>nul
if %errorlevel%==0 goto err4
ping http://www.baidu.com>>%temp%\报告2.txt
if %errorlevel%==0 goto ok
if %errorlevel%==1 goto err2
find "请检查该名称,然后重试" %temp%\报告2.txt>nul
if %errorlevel%==0 goto err3
:err1
echo 网关或网线可能出了一些问题,拍两下试试?
echo 查看具体报告? (y,n)
choice /c yn /n
if %errorlevel%==1 goto bg
if %errorlevel%==2 exit
:err2
echo 网络不通,有各种可能(没交费、电信基站等N种问题)。
echo 查看具体报告? (y,n)
choice /c yn /n
if %errorlevel%==1 goto bg
if %errorlevel%==2 exit
:err3
echo DNS的毛病,换个DNS吧。
echo 查看具体报告? (y,n)
choice /c yn /n
if %errorlevel%==1 goto bg
if %errorlevel%==2 exit
:err4
echo 网络驱动的问题,尝试重新安装吧!(或者是被关在沙箱里得出的结论)
echo 查看具体报告? (y,n)
choice /c yn /n
if %errorlevel%==1 goto bg
if %errorlevel%==2 exit
:ok
echo 一切正常,或许是hosts的问题?
echo 一键修复hosts? (y,n)
choice /c yn /n
if %errorlevel%==1 goto hosts
if %errorlevel%==2 exit
:bg
start %temp%\报告.txt
exit
:hosts
echo 正在生成hosts
echo # Copyright (c) 1993-2009 Microsoft Corp.>>hosts
echo #>>hosts
echo # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.>>hosts
echo #>>hosts
echo # This file contains the mappings of IP addresses to host names. Each>>hosts
echo # entry should be kept on an individual line. The IP address should>>hosts
echo # be placed in the first column followed by the corresponding host name.>>hosts
echo # The IP address and the host name should be separated by at least one>>hosts
echo # space.>>hosts
echo #>>hosts
echo # Additionally, comments (such as these) may be inserted on individual>>hosts
echo # lines or following the machine name denoted by a 'echo #' symbol.>>hosts
echo #>>hosts
echo # For example:>>hosts
echo #>>hosts
echo # 102.54.94.97 rhino.acme.com echo # source server>>hosts
echo # 38.25.63.10 x.acme.com echo # x client host>>hosts
echo # localhost name resolution is handled within DNS itself.>>hosts
echo #127.0.0.1 localhost>>hosts
echo #::1 localhost>>hosts
echo 正在强力修复hosts
del /a /s /f /q C:\Windows\System32\drivers\etc\hosts>nul
xcopy "hosts" "C:\Windows\System32\drivers\etc">nul
del /a /s /f /q hosts>nul
echo 修复完成!
pause
下次更了系统优化助手又可以水233[滑稽]
2015年09月29日 09点09分 2
level 14
TJUGERKFER 楼主
当然,如果在里面加入ipconfig也不错
2015年09月29日 09点09分 3
level 13
支持一下
2015年09月29日 10点09分 4
谢谢支持[哈哈]
2015年09月29日 10点09分
level 9
来看看[乖]
2015年09月29日 10点09分 5
level 1
666
2015年12月26日 02点12分 7
level 9
请问该bat有版权吗,我想将其融合进green helper,谢谢
2015年12月27日 12点12分 8
哦,可以不过得注明版权
2015年12月28日 09点12分
回复 TJUGERKFE好
2015年12月29日 05点12分
level 1
支持
2020年07月26日 02点07分 10
1