Use the netsh command in your batch file:
To disable the interface run:
netsh interface set interface "Local Area Connection" DISABLED
To enable the interface run:
netsh interface set interface "Local Area Connection" ENABLED
If the OS is Win XP the above method will probably not work.
In that case, here is another (a little more complicated) option that works on XP using VB Script. If the interface is enabled this script will disable it, and it will enable it when it is disabled.
Const ssfCONTROLS = 3
sConnectionName = "Local Area Connection"
sEnableVerb = "En&able"
sDisableVerb = "Disa&ble"
set shellApp = createobject("shell.application")
set oControlPanel = shellApp.Namespace(ssfCONTROLS)
set oNetConnections = nothing
for each folderitem in oControlPanel.items
if folderitem.name = "Network Connections" then
set oNetConnections = folderitem.getfolder: exit for
if oNetConnections is nothing then
msgbox "Couldn't find 'Network Connections' folder"
set oLanConnection = nothing
for each folderitem in oNetConnections.items
if lcase(folderitem.name) = lcase(sConnectionName) then
set oLanConnection = folderitem: exit for
if oLanConnection is nothing then
msgbox "Couldn't find '" & sConnectionName & "' item"
bEnabled = true
set oEnableVerb = nothing
set oDisableVerb = nothing
for each verb in oLanConnection.verbs
if verb.name = sEnableVerb then
set oEnableVerb = verb
bEnabled = false
if verb.name = sDisableVerb then
set oDisableVerb = verb
if bEnabled then