1

I need to enable/disable network connections on windows with a batch file.

3 Answers 3

7

You can do this with Windows PowerShell. Here's a page with examples.

Probably you want to use the last one on that page.

Update

A little more searching reminded me about netsh, which is a more appropriate tool than either PowerShell or devcon:

netsh interface set interface "Local Area Connection " ENABLE
netsh interface set interface "Local Area Connection " DISABLE

I'm not sure which version of Windows you're using, but here's the netsh doc for XP to get you started.

Sign up to request clarification or add additional context in comments.

1 Comment

I had to change "Local Area Connection " to "Local Area Connection", but this works great
2

You may use devcon (from MS).

Usage

  devcon disable *INTERFNAME    

Here is a simple tutorial for your intended usage.

HTH!

1 Comment

I had to use this as netsh didnt recognize any of my devices when the computer was booting.
1

netsh wlan connect ssid=*SSID HERE*name= network name HERE interface="Wireless Network Connection"

and

disconnect interface="Wireless Network Connection"

both actually work in windows 7

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.