Save all WLAN profile names stored on my machine, into a textfile

0

1

when I'm using the netsh wlan command, a similarly output is shown.

C:\Windows\system32>netsh wlan show profiles

Profiles on interface Wireless Network Connection:

Group policy profiles (read only)
---------------------------------
    <None>

User profiles
-------------
    All User Profile     : WLAN-313131
    All User Profile     : FRITZ!Box Fon WLAN 7170

I want to write all profiles from this output into a text-file, without all information/text around it.
The output for out.txt should look like:

WLAN-313131
FRITZ!Box Fon WLAN 7170

Is that possible with a script language like batch, to split or filter information, so it fits to my requested output?

MrMAG

Posted 2013-10-30T18:38:53.360

Reputation: 201

You can output the results of the command to a text file by appending > out.txt to the command. It would look like: netsh wlan show profiles > out.txt as far as parsing the information out of there, I would write my batch file to search for the known string "All User Profile" and then have it append the characters after into an array. That array could then be used to create your file of names. I know that this isn't the programming help you are looking for, but the output of the command is a start. – JamesTheDev – 2013-10-30T18:58:52.827

That was my first consideration as well, but I'm looking for a smart solution at script-level. As a last resort I could write a little c#-program that does it for me. – MrMAG – 2013-10-30T19:51:41.257

That is what I was thinking I would do. C# has the ability to do this very easily. – JamesTheDev – 2013-10-30T22:25:32.423

Answers

2

with netsh:

@echo off &setlocal
set "flag="
(for /f "tokens=1*delims=:" %%a in ('netsh wlan show profiles') do (
    if "%%a"=="User profiles" set flag=true
    if defined flag if "%%~b" neq "" (
        for /f "tokens=*" %%c in ("%%~b") do echo(%%c
    )
))>out.txt
type out.txt

Endoro

Posted 2013-10-30T18:38:53.360

Reputation: 2 036

0

This should do as well as make a back up of your profiles. Run as admin to get the export in a way that can be imported with the wireless key in clear text.

MD "%~dp0%COMPUTERNAME%" 
netsh wlan export profile folder="%~dp0%COMPUTERNAME%" key=clear
dir "%~dp0%computername%" /B >> "%~dp0%computername%"\Wireless.txt
pause

Tartarus216

Posted 2013-10-30T18:38:53.360

Reputation: 1