Skip to content

Instantly share code, notes, and snippets.

@huxingyi huxingyi/auto_hosts.bat
Last active Dec 15, 2015

What would you like to do?
@set hosts_path=%systemroot%\System32\drivers\etc\hosts
@set tmp_path=new_hosts
@set hosts_url=
@wget "%hosts_url%" --no-check-certificate -O "%tmp_path%"
@if %errorlevel%==0 goto update
@ping -n 5 -w 1000 > nul
@goto retry
@fc %hosts_path% %tmp_path%
@if %errorlevel%==0 goto exit
@type "%tmp_path%">"%hosts_path%"
@if %errorlevel%==0 goto exit
@attrib "%hosts_path%" -h -r -s
@ping -n 5 -w 1000 > nul
@goto retry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.