Change the batch processing of hosts files with bat
Add mapping between ip and domain name
@ ECHO offECHO "XXXXXX Technology Co., Ltd."ECHO" Please pay attention to your antivirus software tips Be sure to allow "@ ECHO # # @ xcopy C:\ Windows\ system32\ drivers\ etc\ hosts C:\ Windows\ system32\ drivers\ etc\ hosts.bak\ / d / c / I / y@ECHO # # @ ECHO hosts file backup completed Start modifying hosts file @ ECHO@ECHO 10.0.0.2 gitlab.a.com > > C:\ Windows\ System32\ drivers\ etc\ hosts@ECHO 10.0.0.3 gitlab.b.com > > C:\ Windows\ System32\ drivers\ etc\ hosts@ECHO 10.0.0.4 gitlab.c.com > > C:\ Windows\ System32\ drivers\ etc\ hostsECHO "hosts file modification completed" @ ipconfig / flushdns@ECHO "refresh DNS complete" @ ECHO "press any key to exit" @ pause > nul@exit "
Restore backed up hosts files
When the echo hosts file has been modified, press any key to restore the original state of the system @ echo@echo # # @ pause > nul@copy C:\ Windows\ System32\ drivers\ etc\ hosts.bak\ hosts C:\ Windows\ System32\ drivers\ etc\ hosts / y@echo@echo offecho hosts file, press any key to exit @ echo@pause > nul@exit
What's wrong with the hint? Please check whether the environment variable or encoding format is ANSI