Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

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:

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?

share|improve this question
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 Oct 30 '13 at 18:58
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 Oct 30 '13 at 19:51
That is what I was thinking I would do. C# has the ability to do this very easily. – JamesTheDev Oct 30 '13 at 22:25

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
type out.txt
share|improve this answer

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.

netsh wlan export profile folder="%~dp0%COMPUTERNAME%" key=clear
dir "%~dp0%computername%" /B >> "%~dp0%computername%"\Wireless.txt
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .