Set windows bat scripts for IP addresses and Proxies

Source: Internet
Author: User

I can't remember where I copied it. To prevent loss, make a backup.

 1 @echo off
2 cls
3 color 0A
4 Echo The program is running...
5 Echo Setting the ip and dns...
6 netsh interface ip set address name="Local Connection" source=dhcp
7 netsh interface ip delete dns "Local Connection" all
8 ipconfig /flushdns
9 ipconfig /all
10 Echo Done.
11 Echo Setting the proxy
12 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f
13 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "proxy:80" /f
14 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d "" /f
15 ipconfig /flushdns
16 Echo Done.
17 Echo Press any key to leave...
18 Pause

The first part of this Code sets the IP address to be automatically obtained, and then sets the proxy server to "porxy: 80 ";

 1 @echo off
2 cls
3 Echo The program is running...
4 Echo Setting the ip and dns...
5 cmd /c netsh interface ip set address name="Local Connection" source=static addr=192.168.2.12 mask=255.255.255.0 gateway=192.168.2.1 gwmetric=1
6 cmd /c netsh interface ip set dns name="Local Connection" source=static addr=192.168.2.254 primary
7 cmd /c netsh interface ip add dns name="Local Connection" addr=192.168.2.253 index=2
8 ipconfig /all
9 Echo Done
10
11 Echo Setting the proxy...
12 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
13 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /d "" /f
14 reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyOverride /t REG_SZ /d 0 /f
15 Echo Done.
16 Pause

This Code sets a fixed IP address, DNS, and other configuration information, and deletes the proxy settings (the IP addresses in this article are fabricated by me and need to be filled in according to the actual situation ).

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.