Code for modifying a routing table by using a batch connection VPN under Windows _dos/bat

Source: Internet
Author: User

Use the bat script to achieve one-click dialing and add routes.

1, create a PPTP VPN dial-up connection.
2, right key just built a connection – Properties – Network –internet protocol version 4– Properties – Advanced, the IP settings in the "Use of the default gateway on the remote network" hook off.

Copy Code code as follows:

@echo off
Rasdial VPN user name VPN password
for/f "Tokens=16"%%i in ("ipconfig ^|find/i" 192.168.1.) ") do set IP =%%i
Route add 74.0.0.0 Mask 255.0.0.0%ip%

1, the third line of "192.168.1." Is your VPN connection after the success of the IP address, only to write the first three bits on the line, if you do not know the first manual connection, and then to see their own access to the IP.
2, the fourth line is what you need to go VPN tunnel, do not fill in the default to go local route, I fill in here is Google to use the network segment, that is, Google is shielded from the server IP, according to the actual situation modified on the OK.
You can do this batch when you are done with it.

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.