Discussion:
Available Networks
(too old to reply)
Zaidy036
2023-12-18 17:24:54 UTC
Permalink
The following lists available Wi-Fi networks:
C:\WINDOWS\explorer.exe ms-availablenetworks:

but I need the information in a text file or variable to make a Windows
batch to determine the strongest available signal and then login to it.

Suggestions please.
Andy Burns
2023-12-18 17:33:44 UTC
Permalink
Post by Zaidy036
but I need the information in a text file or variable to make a Windows
batch to determine the strongest available signal and then login to it.
Suggestions please.
netsh.exe wlan show networks
Zaidy036
2023-12-18 18:33:29 UTC
Permalink
Post by Andy Burns
Post by Zaidy036
but I need the information in a text file or variable to make a
Windows batch to determine the strongest available signal and then
login to it.
Suggestions please.
netsh.exe wlan show networks
I had tried NETSH WLAN SHOW NETWORKS and some times it shows all and
other times ONLY the one connected to (visible).

I do not see an option to ALWAYS show all.

Gives SSID so batch should be able to find speed to compare when it
reliably shows all.
Andy Burns
2023-12-18 18:39:46 UTC
Permalink
Post by Zaidy036
I had tried NETSH WLAN SHOW NETWORKS and some times it shows all and
other times ONLY the one connected to (visible).
I hadn't noticed that, but you're right.
Post by Zaidy036
I do not see an option to ALWAYS show all.
it seems if I run the ms-availablenetworks first, then run the netsh,
you then get all visible, not just the one connected?
Post by Zaidy036
Gives SSID so batch should be able to find speed to compare when it
reliably shows all.
Zaidy036
2023-12-18 19:00:47 UTC
Permalink
Post by Andy Burns
Post by Zaidy036
I had tried NETSH WLAN SHOW NETWORKS and some times it shows all and
other times ONLY the one connected to (visible).
I hadn't noticed that, but you're right.
Post by Zaidy036
I do not see an option to ALWAYS show all.
it seems if I run the ms-availablenetworks first, then run the netsh,
you then get all visible, not just the one connected?
Post by Zaidy036
Gives SSID so batch should be able to find speed to compare when it
reliably shows all.
Interesting. Will test.
VanguardLH
2023-12-18 19:35:29 UTC
Permalink
Post by Zaidy036
but I need the information in a text file or variable to make a Windows
batch to determine the strongest available signal and then login to it.
Suggestions please.
While other tools might show the same info, my first thought is
PowerShell could probably show all info on all adapters.

https://learn.microsoft.com/en-us/powershell/module/netadapter/get-netadapter?view=windowsserver2022-ps
Zaidy036
2023-12-19 02:32:13 UTC
Permalink
Post by Zaidy036
but I need the information in a text file or variable to make a Windows
batch to determine the strongest available signal and then login to it.
Suggestions please.
Out of interest I made the following batch to output lists of SSIDs from
the NETSH output:
NOTES:
first FOR /L cmd is number of lists to make.
second FOR /L cmd is SSIDs to list, may line wrap.
TIMEOUT is optional and number of seconds between lists
FOR /L %%N IN (1,1,3) DO (
DEL F:\_Network?.txt > NUL 2>&1
C:\WINDOWS\explorer.exe ms-availablenetworks:
NETSH.EXE WLAN SHOW NETWORKS >> F:\_NetworkS.txt
FOR /L %%S IN (1,1,15) DO (FINDSTR /C:"SSID %%S " F:\_NetworkS.txt
Post by Zaidy036
F:\_NetworkL%%N.txt)
TIMEOUT /T 5 > NUL
)

Comparing F:\_NetworkL%%N.txt lists you will see that the order of SSIDs
produced appears to be by signal strength and could be used to change
Wi-Fi network connection.
Zaidy036
2023-12-19 02:35:13 UTC
Permalink
Post by Zaidy036
but I need the information in a text file or variable to make a Windows
batch to determine the strongest available signal and then login to it.
Suggestions please.
Out of interest I made the following batch to output lists of SSIDs from
the NETSH output:
NOTES:
first FOR /L cmd is number of lists to make.
second FOR /L cmd is SSIDs to list, may line wrap.
TIMEOUT is optional and number of seconds between lists
FOR /L %%N IN (1,1,3) DO (
DEL F:\_Network?.txt > NUL 2>&1
C:\WINDOWS\explorer.exe ms-availablenetworks:
NETSH.EXE WLAN SHOW NETWORKS >> F:\_NetworkS.txt
FOR /L %%S IN (1,1,15) DO (FINDSTR /C:"SSID %%S " F:\_NetworkS.txt >>
F:\_NetworkL%%N.txt)
TIMEOUT /T 5 > NUL
)

Comparing F:\_NetworkL%%N.txt lists you will see that the order of SSIDs
produced appears to be by signal strength and could be used to change
Wi-Fi network connection.
Zaidy036
2023-12-22 16:50:12 UTC
Permalink
Post by Zaidy036
Post by Zaidy036
but I need the information in a text file or variable to make a
Windows batch to determine the strongest available signal and then
login to it.
Suggestions please.
Out of interest I made the following batch to output lists of SSIDs from
   first FOR /L cmd is number of lists to make.
   second FOR /L cmd is SSIDs to list, may line wrap.
   TIMEOUT is optional and number of seconds between lists
FOR /L %%N IN (1,1,3) DO (
DEL F:\_Network?.txt > NUL 2>&1
NETSH.EXE WLAN SHOW NETWORKS >> F:\_NetworkS.txt
FOR /L %%S IN (1,1,15) DO (FINDSTR /C:"SSID %%S " F:\_NetworkS.txt >>
F:\_NetworkL%%N.txt)
TIMEOUT /T 5 > NUL
)
Comparing F:\_NetworkL%%N.txt lists you will see that the order of SSIDs
produced appears to be by signal strength and could be used to change
Wi-Fi network connection.
I have searched but cannot confirm what criteria is used to set the
order of SSIDs produced by either:
A: C:\WINDOWS\explorer.exe ms-availablenetworks:
B. NETSH WLAN SHOW NETWORKS
and the lists are in different order.

A. First is the connected network followed by signal strength?
B. No obvious list order

Anybody know?

Loading...