@ React82
das klingt gut. da habe ich anhaltspunkte für eine recherche. danke.
@ webapache
auch dir ein kleines danke, für die aufgabe des moralapostels. ich denke aber das du in einem warez-forum falsch aufgehoben bist.
zudem:
wie ich meine kinder erziehe kannst du anhand eines kleinem textes, welcher ein völlig anderes thema behandelt, nicht sehen bzw. erkennen.
Nach dem Tip von React82 mit der command-line bin ich auf .vbs s*****s gestoßen und habe sie mir etwas angepasst.
----
neue textdatei erstellen.
umbennen von textdokument
.txt in wunschname
.vbs
- im s***** "LAN1" durch das eigene ersetzten z.b. local area connetion
- im s***** die sprache des betriebssystems anpassen:
Englisch :
- strEnable = "En&able"
- strDisable = "Disa&ble"
Deutsch :
- strEnable = "&Aktivieren"
- strDisable = "&Deaktivieren"
Netzwerkverbindung EIN schalten
'~ Toggle a SPECIFIED NIC on or off
Option Explicit
Const NETWORK_CONNECTIONS = &H31&
Dim objShell, objFolder, objFolderItem, objEnable, objDisable
Dim folder_Object, target_NIC
Dim NIC, clsVerb
Dim str_NIC_Name, strEnable, strDisable
Dim bEnabled, bDisabled
' ================================================== ======
' ===== place the name of your network adapter here ======
' examples:
' str_NIC_Name = "Local Area Connection 2"
' str_NIC_Name = "Wireless Connection 1"
' ================================================== ======
str_NIC_Name = "LAN1"
' ================================================== ======
strEnable = "En&able"
strDisable = "Disa&ble"
' create objects and get items
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(NETWORK_CONNECTIONS)
Set objFolderItem = objFolder.Self
Set folder_Object = objFolderItem.GetFolder
' see if the namespace exists
If folder_Object Is Nothing Then
Ws*****.Echo "Could not find Network Connections"
WS*****.Quit
End If
Set target_NIC = Nothing
' look at each NIC and match to the chosen name
For Each NIC In folder_Object.Items
If LCase(NIC.Name) = LCase(str_NIC_Name) Then
' proper NIC is found, get it
Set target_NIC = NIC
End If
Next
If target_NIC Is Nothing Then
WS*****.Echo "Unable to locate proper NIC"
WS*****.Quit
End If
bDisabled = True
Set objEnable = Nothing
Set objDisable = Nothing
For Each clsVerb In target_NIC.Verbs
'~ Ws*****.Echo clsVerb
If clsVerb.Name = strDisable Then
Set objDisable = clsVerb
bDisabled = False
End If
If clsVerb.Name = strEnable Then
Set objEnable = clsVerb
End If
Next
If bDisabled Then
objEnable.DoIt
End If
'~ Give the connection time to stop/start
WS*****.Sleep 1000
WS*****.Quit
Netzwerkverbindung AUS schalten
'~ Toggle a SPECIFIED NIC on or off
Option Explicit
Const NETWORK_CONNECTIONS = &H31&
Dim objShell, objFolder, objFolderItem, objEnable, objDisable
Dim folder_Object, target_NIC
Dim NIC, clsVerb
Dim str_NIC_Name, strEnable, strDisable
Dim bEnabled, bDisabled
' ================================================== ======
' ===== place the name of your network adapter here ======
' examples:
' str_NIC_Name = "Local Area Connection 2"
' str_NIC_Name = "Wireless Connection 1"
' ================================================== ======
str_NIC_Name = "LAN1"
' ================================================== ======
strEnable = "En&able"
strDisable = "Disa&ble"
' create objects and get items
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(NETWORK_CONNECTIONS)
Set objFolderItem = objFolder.Self
Set folder_Object = objFolderItem.GetFolder
' see if the namespace exists
If folder_Object Is Nothing Then
Ws*****.Echo "Could not find Network Connections"
WS*****.Quit
End If
Set target_NIC = Nothing
' look at each NIC and match to the chosen name
For Each NIC In folder_Object.Items
If LCase(NIC.Name) = LCase(str_NIC_Name) Then
' proper NIC is found, get it
Set target_NIC = NIC
End If
Next
If target_NIC Is Nothing Then
WS*****.Echo "Unable to locate proper NIC"
WS*****.Quit
End If
bEnabled = True
Set objEnable = Nothing
Set objDisable = Nothing
For Each clsVerb In target_NIC.Verbs
'~ Ws*****.Echo clsVerb
If clsVerb.Name = strEnable Then
Set objEnable = clsVerb
bEnabled = False
End If
If clsVerb.Name = strDisable Then
Set objDisable = clsVerb
End If
Next
If bEnabled Then
objDisable.DoIt
End If
'~ Give the connection time to stop/start
WS*****.Sleep 1000
WS*****.Quit
Netzwerkverbindung AN und AUS Switchen in einem S*****
'~ Toggle a SPECIFIED NIC on or off
Option Explicit
Const NETWORK_CONNECTIONS = &H31&
Dim objShell, objFolder, objFolderItem, objEnable, objDisable
Dim folder_Object, target_NIC
Dim NIC, clsVerb
Dim str_NIC_Name, strEnable, strDisable
Dim bEnabled, bDisabled
' ================================================== ======
' ===== place the name of your network adapter here ======
' examples:
' str_NIC_Name = "Local Area Connection 2"
' str_NIC_Name = "Wireless Connection 1"
' ================================================== ======
str_NIC_Name = "LAN1"
' ================================================== ======
strEnable = "En&able"
strDisable = "Disa&ble"
' create objects and get items
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(NETWORK_CONNECTIONS)
Set objFolderItem = objFolder.Self
Set folder_Object = objFolderItem.GetFolder
' see if the namespace exists
If folder_Object Is Nothing Then
Ws*****.Echo "Could not find Network Connections"
WS*****.Quit
End If
Set target_NIC = Nothing
' look at each NIC and match to the chosen name
For Each NIC In folder_Object.Items
If LCase(NIC.Name) = LCase(str_NIC_Name) Then
' proper NIC is found, get it
Set target_NIC = NIC
End If
Next
If target_NIC Is Nothing Then
WS*****.Echo "Unable to locate proper NIC"
WS*****.Quit
End If
bEnabled = True
Set objEnable = Nothing
Set objDisable = Nothing
For Each clsVerb In target_NIC.Verbs
'~ Ws*****.Echo clsVerb
If clsVerb.Name = strEnable Then
Set objEnable = clsVerb
bEnabled = False
End If
If clsVerb.Name = strDisable Then
Set objDisable = clsVerb
End If
Next
If bEnabled Then
objDisable.DoIt
Else
objEnable.DoIt
End If
'~ Give the connection time to stop/start
WS*****.Sleep 1000
WS*****.Quit