Home > Software engineering >  Switching network connection, and Windows API or command window
Switching network connection, and Windows API or command window

Time:10-06

Double card, in the network connection of the control panel display has two connections "network connection 1", "network connection 2"
Often have to manually shut down a, open another, want to write a program, or written in a Windows command a bat, strives for the command ~

CodePudding user response:

Above is a little wrong, the connection name should be "local connection", "local connection 2" (avoid causing misunderstanding)

CodePudding user response:

http://www.uzzf.com/soft/26283.html

CodePudding user response:

 if "% 1"=="l" goto l 
If "% 1"=="w" goto w
Echo network address switch batch
Echo setip l - switch to the local connection
Echo setip w - switch to the wireless network connection
Goto e

: l
Echo switch from static IP wireless network to the wired network static IP:
Netsh interface IP set the DHCP address wireless network connection
Netsh interface DHCP IP set the DNS wireless network connection
Netsh interface IP set address local connection static 192.168.1.111 255.255.252.0 192.168.2.1 1
Netsh interface IP set DNS local connection static 202.106.196.115
Goto e

: w
Echo from static IP switch to the wired network infinite network static IP:
Netsh interface IP set address local connection DHCP
Netsh interface IP set DNS local connection DHCP
Netsh interface IP set static address wireless network connection 192.168.1.5 255.255.255.0 192.168.1.1 1
Netsh interface IP set DNS wireless network connection static 211.97.168.129
Goto e

E

CodePudding user response:

http://superuser.com/questions/735292/how-to-open-tcp-ip-properties-from-cmd-or-run-directly

CodePudding user response:

I'm using
Open_wan. Bat
 netsh interface set interface "4 wireless network connection" enabled 
Netsh interface set interface "local connection" disabled
Open_lan. Bat
Netsh interface set interface "4 wireless network connection" disabled
Netsh interface set interface "local connection" enabled

CodePudding user response:

reference 5 floor scy2510 reply:
I'm using
Open_wan. Bat
 netsh interface set interface "4 wireless network connection" enabled 
Netsh interface set interface "local connection" disabled
Open_lan. Bat
Netsh interface set interface "4 wireless network connection" disabled
Netsh interface set interface "local connection" enabled

Testing and prompt the following words
Netsh interface set interface "local connection" disabled
The name of the interface is not registered with the router,

CodePudding user response:

reference 5 floor scy2510 reply:
I'm using
Open_wan. Bat
 netsh interface set interface "4 wireless network connection" enabled 
Netsh interface set interface "local connection" disabled
Open_lan. Bat
Netsh interface set interface "4 wireless network connection" disabled
Netsh interface set interface "local connection" enabled

Know, run with administrator account
  • Related