yesterday I have found that I can't use the wireless network at some spots in my house. I used another modem as a WiFi booster and I managed to cover these spots.
The problem is that when I go to these dead spots I need to use static IP and change my primary dns servers, or I get limited connection. Also, I still want to use DHCP when I'm not in these spots.
I have written two batch files and a python script to define the wireless adapter settings.
I would like someone to take a look and suggest how to improve it.
Batch Files (I'm using shortcuts because of the option to run them as administrator)
DeadSpots.bat.ink
netsh interface ip set address "Wi-Fi" static 192.168.x.x 255.255.255.0 192.168.x.x netsh interface ip set dns "Wi-Fi" static 192.168.x.x primary # This is the second modem netsh interface ip add dns "Wi-Fi" ISP.dns.IP index=2
Regular.bat.ink
netsh interface ip set address "Wi-Fi" dhcp netsh interface ip set dnsservers "Wi-Fi" source=dhcp
Python code
import subprocess as sub
def WiFi():
filepath1 = Path_To_DeadSpots.bat.ink
filepath2 = Path_To_Regular.bat.ink
loc = input("Please choose your location: 1-Rooms, 2-Rest \n")
while(loc != "1" and loc != "2"):
print("Wrong input, please choose again")
loc = input("Please choose your location: 1-Rooms, 2-Rest \n")
if loc == "1":
p = sub.Popen(filepath1,shell=True,stdout=sub.PIPE)
else:
p = sub.Popen(filepath2,shell=True,stdout=sub.PIPE)
WiFi()
Please suggest improvements, thank you.