I started writing this small batch file, where I get all the wlan data with:
netsh wlan show profile (name) key=clear
This is not a problem but I am asking if there is a variable like for example:
%CurrentWlan%
so I can do:
netsh wlan show profile %CurrentWlan% key=clear >wlan.txt
Here is a possible solution:
@echo off
for /f "eol=B tokens=*" %%A IN ('netsh wlan show interfaces ^| findstr SSID') do (
for /f "delims=: tokens=2" %%A IN ("%%A") do (
for /f "tokens=*" %%A IN ("%%A") do (
netsh wlan show profiles "%%A" key=clear >wlan.txt
)
)
)
Which I am going to break it down:
netsh wlan show interfaces
searching for SSID
string. As there is also a line containing B
SSID
we ignore it with eol=B
.
:
symbol, so we set it as delimeter. We can access the network name, now, setting tokens
to 2
.
for
loop specifying tokens
option to *
.
%%A
). We redirect output to wlan.txt
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.