📜 ⬆️ ⬇️

Switch network settings in laptops in two clicks

Now, when the Internet is no longer something strange and out of reach for everyone, and laptops have become affordable, there is a problem when there are different Internet connection settings at home and in the office (ip, dns, gateway, proxy, etc.) that need to be changed every time. A few weeks ago I was asked to automate everything as it had to be done quickly, I found one of the old-fashioned programs that earned it. But I didn’t stop at that, I was looking for something simpler, because the disadvantage of these programs was that, firstly, they are paid, secondly, they hang in my memory all the time taking your “precious bytes”, thirdly, downloading Varez sites Varez programs risk picking up a virus, well, the last thing is why use something else when you can organize everything using the operating system (for example, windows).

Let's start. Create two text files get_home.bat, get_office.bat in which we write only one line

get_home.bat -> netsh dump> home.cfg
get_office.bat -> netsh dump> office.cfg

Thus, we will create a network settings dump and write them into a daddy with scripts. You can read more about the netsh command here , or by typing netsh help. These two files, running each time respectively at work and at home (before that you need to set up the network for the last time manually), we determine the basic network settings on our working (and not so) places.
Next we need to create two files. that the settings will be bridged, let's call them set_home.bat, set_office.bat . Their contents:
')
set_home.bat -> netsh exec home.cfg
set_office.bat -> netsh exec office.cfg

Almost everything is ready, now all this should be placed in one folder, display icons on the desktop and use.
I neatly packed all these files into an archive and placed it on Google code , naming that mr.yans (mister yet another net switcher) . So as someone needs - take .

Pn If someone needs such a thing under Linux, ask - the possibilities of the nix shell are great :). Have a nice day.

Source: https://habr.com/ru/post/31411/


All Articles