copy con is a legacy command that allows a plain MSDOS to create text file such as autoexec.bat and config.sys
From my experience, the command is supported from MSDOS 3.30 till today. Have yet to test this command in Windows 11 OS.
To commit and save the file into disk, use CTRL + Z
This command was learned/discovered during the days before existence of Internet, by attentively looking over the shoulder of seniors, who are not willing to teach during computer club session.
@echo off
netsh wlan show profiles |findstr All > tmp.txt
for /f "tokens=2 delims=:" %%a in (tmp.txt) do (
echo %%a
netsh wlan show profiles name=%%a key=clear
)
del tmp.txt
This batch script will list out list of saved wifi profiles, save the profile into text file tmp.txt
From the file tmp.txt, print out the 2nd token from the text file which will returns the WiFi profile name, then using the same command to expose WiFi key in clear text.