一鍵更換hosts
阿新 • • 發佈:2019-01-31
利用powershell隨便寫的一些垃圾,小工具而已(。
@echo off
mode con lines=30 cols=60
%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
cd /d "%~dp0"
:main
cls
echo.Choose the number:
echo.
echo. 1.change hosts (1)
echo.
echo. 2.reset hosts (2)
echo .-----------------------------------------------------------
set /p choice=Input number and press enter:
echo.
if %choice%==1 goto host DNS
if %choice%==2 goto CL
cls
"set choice="
echo input error!
ping 127.0.1 -n "2">nul
goto main
:host DNS
cls
copy /y "hosts" "%SystemRoot%\System32\drivers\etc\hosts"
ipconfig /flushdns
cls
echo. done
echo.
goto end
:CL
cls
@echo 127.0.0.1 localhost > %SystemRoot%\System32\drivers\etc\hosts
ipconfig /flushdns
cls
echo done
echo.
goto end
:end
echo Press any key to exit.
@Pause>nul