I was wondering if a batch script existed for automatically disabling an ethernet adaptor and enabling a wifi adaptor, I imagine that it'll require some fiddling with id's etc.

The reason for this is that my ethernet internet is metered, while my wifi is not. Hence I would like some easy way of switching between the two depending on whether I need the low packet loss of the ethernet connection.

The other possibility is whether there is a way to set certain programs to ignore an adaptor, i.e. make google chrome etc. not use ethernet, while everything else defaults to etherent?

End Result thanks to Seth

if( (Get-NetAdapter -Name "WiFi").Status -eq "Disabled"){
  Disable-NetAdapter -Name "Ethernet"
  Enable-NetAdapter -Name "Wifi"
  "Wifi enabled, Ethernet disabled"
  Disable-NetAdapter -Name "Wifi"
  Enable-NetAdapter -Name "Ethernet"
  "Ethernet enabled, Wifi disabled"

The reason that it checks for disabled rather than enabled, is due to there not being a status enabled (that I could see in my speed read) (that status is split into connecting etc.).

For my own convenience I made it into a batch file using the -EncodedCommand flag for powershell.


If you look at this question: How can I write a batch file to toggle my network adapters?

You'll see that there are several options available. As you're saying you're running Windows 10. I'd rather use a PowerShell script. It could be as simple as combining Get-NetAdapter, Enable-NetAdapter and Disable-NetAdapter.

I don't have Windows 10 but it would propabably look something like this:

if( (Get-NetAdapter -Name "WLAN").Enabled -eq $True){
  Disable-NetAdapter -Name "WLAN"
  Enable-NetAdapter -Name "LAN"
  Disable-NetAdapter -Name "LAN"
  Enable-NetAdapter -Name "WLAN"

This doesn't have any error handling so there are probably a lot of cases which are not covered. If you'd wand to do this in a batch you could follow the same pattern but use netsh and it's output instead. Also have a look at the question for that is has some more information in that regard.

  • Thanks thats just about perfect, just after I posted this I kind of realised that powershell maybe has a something and what you're answered is basically what I was starting to write so thanks for saving me a tonne of time. – Cjen1 Nov 7 '16 at 14:02
  • You will have to verify whenever Get-NetAdapter does expose an "Enabled" member or similar, as I said I don't have Windows 10 available right now. ;) – Seth Nov 7 '16 at 14:06
  • Yeah I'm having a look into it – Cjen1 Nov 7 '16 at 14:10
  • So it is exposed, but the issue is that disable/enable aren't doing anything, still looking into it, thanks for your help so far – Cjen1 Nov 7 '16 at 14:12
  • 1
    So I got the script finished and working, I'm going to post the result in the bottom of my question – Cjen1 Nov 7 '16 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.