I am trying to get all known WiFi SSIDs including the Password.
When I use the following script, I can't get it to work to set the SSIDs in doublequotes, (so blanks and so on are correctly used).
Also when I've got special characters like exclamation marks, they dissapear.
Can someone please help me?
@ECHO OFF
setlocal EnableExtensions DisableDelayedExpansion
color 02
netsh wlan show profiles | findstr /R /C:"[ ]:[ ]" > temp.txt
echo @echo off >> helper.bat
echo setlocal enabledelayedexpansion >> helper.bat
echo for /f "tokens=5*" %%%%i in (temp.txt) do ( set val=%%%%i %%%%j >> helper.bat
echo if "!val:~-1!" == " " set val=!val:~2,-1! >> helper.bat
echo echo !val! ^>^> final.txt) >> helper.bat
echo for /f "tokens=*" %%%%i in (final.txt) do @echo SSID: %%%%i ^>^> others_%computername%.txt ^& echo # ================================================ ^>^> others_%computername%.txt ^& netsh wlan show profiles name=%%%%i key=clear ^| findstr /N /R /C:"[ ]:[ ]" ^| findstr 33 ^>^> others_%computername%.txt ^& echo # ================================================ ^>^> others_%computername%.txt ^& echo # Key content is the password of your target SSID. ^>^> others_%computername%.txt ^& echo # ================================================ ^>^> others_%computername%.txt >> helper.bat
REM echo del /f /q temp.txt final.txt >> helper.bat
echo exit >> helper.bat
start "" /wait helper.bat
exit
Output is for example: Original (temp.txt):
Profil fr alle Benutzer : 1FRITZ!Box Fon WLAN 7390
Output in final.txt:
1FRITZBox Fon WLAN 7390
What it should look like in final.txt:
"1FRITZ!Box Fon WLAN 7390"