netsh Interface name store as variable
Posted: 13 Oct 2023 02:17
hello guys,
so netsh interface show interface gives me this:
and I am looking for a way to store the Interface Name which has state connected (in this example it wold be "Ethernet 2" as variable,
so later on I can do soemthing like this:
but instead hardcoded interface name, i would like to use the one from variable set above...
how can I do that?
so netsh interface show interface gives me this:
Code: Select all
Admin State State Type Interface Name
-------------------------------------------------------------------------
Enabled Disconnected Dedicated Wi-Fi
Enabled Connected Dedicated Ethernet 2
Enabled Disconnected Dedicated Ethernet
so later on I can do soemthing like this:
Code: Select all
@NETSH interface set interface "Ethernet 2" DISABLED
@NETSH interface set interface "Ethernet 2" ENABLED
how can I do that?