In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail how to use bat files to make a HOSTS fast switch. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
The trouble of switching HOSTS files
The IPV6 in the school is free, and you don't have to climb over the wall under IPV6, but under IPV6, there are some websites that have IPV6 IP but no domain name. So it can only be accessed by modifying the HOSTS file.
In addition, under IPV4, many Google services need to be modified by the HOSTS file before they can be accessed normally.
Therefore, you need to switch HOSTS files several times a day.
Is there any way to simplify this operation?
HOSTS switching software
I searched a lot of software on the Internet, but it was not very easy to use. I even had the impulse to make one by myself.
The logic of the design basically goes like this:
1. The software saves the IP addresses of many domain names, and each domain name has an IPV4 address and an IPV6 address (it will be judged automatically according to the network situation).
2. The software can save many solutions, and each click of a solution can perform a series of operations, such as: 1, clear HOSTS;2, add XXX, and for example: 1, do not modify the current HOSTS; 2, disable XXX
This allows you to control the HOSTS file very freely.
Solution
Once it occurred to me, "Why bother?" Back up different HOSTS files and copy which one you need.
Is it still troublesome? Can't you just write the bat file? Although it is not possible to achieve the above advanced functions, it can also meet daily needs.
1. Create different HOSTS schemes
I have built three new ones here, one is empty, one is under IPV4, and one is under IPV6.
2. Start writing bat files
The code is as follows:
@ echo *
@ echo * HOSTS switch *
@ echo * 1muri-clear *
@ echo * 2--IPV4 *
@ echo * 3--IPV6 *
@ echo *
@ choice / c 123
If errorlevel 3 goto IPV6
If errorlevel 2 goto IPV4
If errorlevel 1 goto CLEAR
: CLEAR
Copy / y "C:\ Windows\ System32\ drivers\ etc\ hosts.ics"C:\ Windows\ System32\ drivers\ etc\ HOSTS"
Goto END
: IPV4
Copy / y "C:\ Windows\ System32\ drivers\ etc\ hosts.ipv4"C:\ Windows\ System32\ drivers\ etc\ HOSTS"
Goto END
: IPV6
Copy / y "C:\ Windows\ System32\ drivers\ etc\ hosts.ipv6"C:\ Windows\ System32\ drivers\ etc\ HOSTS"
Goto END
: END
It's very easy to understand here, just write according to it.
3. Remaining problems
There is also a problem, operating HOSTS is very dangerous (antivirus software thinks so)
So it is inevitable to pop up a warning window, there is no way to ignore it, and add it to the whitelist
On "how to use bat files to make HOSTS fast switch" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.