I'm trying to get wifi Channel output from netsh command to be 2.4GHz or 5GHz
The following provides me with Channel output:
netsh wlan show interface name=Wi-Fi | findstr "Channel"
Output is "Channel : 161"
2.4GHz = (Channel 1 - 11) OR 5GHz = (Channel 36 - 177)
I am having problems in a batch file to save the netsh output to a variable and then evaluate the variable, if <=11 it's 2GHz OR >= 36 but <=177 it's 5GHz
Any help is appreciated!
for /f "tokens=2 delims=:" %%r in ('netsh wlan show interface name=WiFi^|findstr "Channel"') do Set Channel=%%r
This will leave a space before the %%r but you shouldn't need to trim it for your use. Add aecho "%Channel%"
to see the results. I could write this whole batch file for you but I HIGHLY suggest that you take the tidbit I gave you and solve the rest. Useif /?
to figure out the greater than and less than logic.