Hello,
thank you for the input, actually it worked, however I assume as a workaround,
because basicaly there are only two possible scenarios,
this is my netsh interface show interface before running the script:
Code: Select all
Admin State State Type Interface Name
-------------------------------------------------------------------------
Enabled Disconnected Dedicated Wi-Fi
Enabled Connected Dedicated Ethernet 2
Enabled Connected Dedicated VMware Network Adapter VMnet1
Enabled Connected Dedicated VMware Network Adapter VMnet8
Enabled Disconnected Dedicated Ethernet
so basicaly i always want to skip the VMware,
and form here, always either one of Ethernets will be connected (not both), or none of them but Wi-Fi will.
However, its possible that both Wi-Fi and one of the Ethernet will be connected... in this case I wish to prefer to store as variable the connected Ethernet as priority.
I know I have already asked a lot... but can I kindly ask to modify one last time according to this explanation?
Summary:
- skip VMWare(s)
- if both Wi-Fi and one of Ethernet(s) are connected, prefer the Ethernet
- in theory there could be only one of each (wifi or ethernet), or more of each too
- if none is connected (which is weird), i would keep what you just did and at the beginning of script I would manualy do: "SET "AdapterName=Wi-Fi""
Thank you guys, you are real life savers