views:

63

answers:

2

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

+1  A: 

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.

egrunin
+1  A: 

You may use devcon (from MS).

Usage

  devcon disable *INTERFNAME    

Here is a simple tutorial for your intended usage.

HTH!

belisarius