删除本地hosts指定字符所在行
@echo off
rem -----------------------检查本地DNS解析并删除无效的解析---------------
set filename1="C:\Windows\System32\drivers\etc\hosts"
set filename2="C:\Windows\System32\drivers\etc\hosts-bak"
if exist %filename1% (
copy %filename1% %filename2%
del %filename1%
)
set str1=111
set str2=222
findstr /r /v /e "! %str1%" %filename2% > %filename1%
findstr /r /v /e "! %str2%" %filename2% > %filename1%
rem ---------------------------------------------------------------------
rem -----------------------检查本地DNS解析并删除无效的解析---------------
ipconfig/flushdns
ping onebox.boe.com.cn
ping boebox.boe.com.cn
color 0a
echo.--------------------------------------------
echo. 请确认所ping网站对应IP是否xxxx
echo.---------------------------------------------
rem -----------------------------------------------
pause
本文来自博客园,作者:你好!2022,转载请注明原文链接:https://www.cnblogs.com/jzhg/p/17409533.html