Link to home
Start Free TrialLog in
Avatar of axcx
axcx

asked on

establishing connection from a command line

How can I connect or disconnect the internet using a command line? The connection is configured in a control panel. It is about turning it on and off.
Avatar of Gary
Gary
Flag of Ireland image

Replace Local Area Connection if it is named differently

netsh interface set interface "Local Area Connection" disabled

netsh interface set interface "Local Area Connection" enabled

Open in new window

ipconfig/release will disconnect
ipconfig /renew will reconnect
Are you wanting to disable the network connection? Or just communication to the internet? (But still communicate over the network?) the following must be run from an elevated command prompt. (Run As Administrator)

wmic path win32_networkadapter where NetConnectionID="Wireless Network Connection" call disable
wmic path win32_networkadapter where NetConnectionID="Wireless Network Connection" call enable

Change the NetConnectionID to match the interface you want to disable/enable.

Hope this helps!

:o)

Bartender_1
Avatar of axcx
axcx

ASKER

In fact I want to reconnect a usb modem (dial-up connection to the internet). I can do it form an external app or control panel. But I want to do it from a command line.
Well the solution is above.
ASKER CERTIFIED SOLUTION
Avatar of Bartender_1
Bartender_1
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of axcx

ASKER

Very close but I everytime I execute rasphone -d <destination name> another window pops up and I have to press enter. I want to skip it.
Avatar of axcx

ASKER

Rasdial does the trick. But because your comment helped me find the solution I accept it.