At my work, there is a company intranet I can connect to, as well as a Wifi network. But, it is company policy that we cannot connect to both networks simultaneously on one machine.
I need to use either network at different times though, and the only way I've been able to do so is by going to "Change Adapter Settings" somewhere in the Network section of Control Panel, then disabling whichever adapter I'm using (either local area network or wifi) and enabling the other one.
As a programmer the repetitiveness and tediousness of this task bothers me, so is there a script I could write to toggle these?
You should look into netsh:
ex: netsh interface set interface "Local Area Connection" DISABLED
(or ENABLED
)
create 2 scripts that do an ENABLED on the one you want and DISABLED on the other, and vice versa (or 1 script that first sees which one is up and which is down, and inverts)
This command can also list the state of the interfaces.
But it behaves differently (or uses a different syntax) between several flavors of windows... so you can also have a look at MicroSoft' devcon. Or another possibility: wmic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With