Using BAT file to make HOSTS fast switch _dos/bat

Source: Internet
Author: User
Tags goto
The trouble of switching HOSTS file

School IPV6 Free, and IPV6 under is not to turn over the wall, but IPV6, there are some sites, although there are IPV6 IP but there is no domain name ... Therefore, only by modifying the HOSTS file to access.
In addition, under the IPV4, Google's many services need to modify the HOSTS file before normal access ...
So, in peacetime need to switch several times a day HOSTS files.
Is there any way to simplify this operation?

HOSTS Switching software

Internet search for a lot of software, but are not very easy to use, and even have the impulse to do one of their own.

The logic of design is basically this:

1, the software has saved a lot of domain name IP address, and each domain name has a IPV4 address and a IPV6 address (will automatically judge according to the network situation)
2, software can save a lot of programs, each click a program can perform a series of operations, such as: 1, empty hosts;2, add XXX, another example: 1, do not modify the current HOSTS; 2, disable XXX

This can be very free to control the HOSTS file.

Solution

Once it occurred to me, why do you have to be so troublesome? The different HOSTS file back up, you need to copy the past not on the line?
Still a lot of trouble? Can you just write a bat file? Although it is not possible to achieve the above advanced functionality, it can also meet everyday needs.

1, the new different HOSTS program



Here I have three new, one is empty, one is under the IPV4, one is IPV6 under the

2. Start writing BAT file

Copy Code code as follows:

@echo *****************
@echo * HOSTS Switch *
@echo * 1--Empty *
@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, just follow the letter.

3. Legacy issues

There is also a problem, the operation of the HOSTS is very dangerous (antivirus software is so think)
So the inevitable pop-up warning window, no way, ignore it, and add to the whitelist can be

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.