Total Pageviews

Sunday 8 February 2015

一个BAT文件用来清除dns缓存

 复制下面内容到记事本,保证编码模式为ansi,改后缀为bat,执行即可(php文件必须保证是utf-8标准)

@echo off    ::这里指的下面命令不显示输入过程,加@指的是echo本身也不显示
 
title ~~~~~~~~~~清理DNS   IP放归~~~~~~~~~~
                
    @echo +-------------------------------------------------------------+ 
         
    @echo.                 ::这里加点是输出空行                                              
    @echo 正在清除dns缓存,请稍后.......
 
    @echo.                                                              
         
    @echo +-------------------------------------------------------------+ 
         
::这里>nul指的是不显示命令结果
ping -n 2 127.1 >nul 
ipconfig /flushdns >nul   
         
    @echo.                                                                
         
    @echo 清除dns缓存完成...............
  
    @echo.                                                              
         
    @echo +-------------------------------------------------------------+ 
         
    @echo.         
  
    @echo 如果继续请按 1 ,否则其它键退出
    @echo.
    @echo +-------------------------------------------------------------+ 
         
set /p X=
if "%X%"=="1" goto 1
ping -n 2 127.1 >nul
exit
         
:1
cls
    @echo +-------------------------------------------------------------+ 
         
    @echo.         
  
    @echo 正在释放ip,请稍后.......
    @echo.
    @echo +-------------------------------------------------------------+
             
ipconfig /release >nul 
ping -n 4 127.1 >nul         
    @echo.            
  
    @echo 正在重获ip,请稍后.......
    @echo.
    @echo +-------------------------------------------------------------+              
   
ipconfig /renew >nul              
         
    @echo.         
  
    @echo ip放归完成,按任意键退出...
    @echo.
    @echo +-------------------------------------------------------------+
pause >nul

exit