Skip to content

Instantly share code, notes, and snippets.

@dolmen
Created March 10, 2011 17:54
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save dolmen/864551 to your computer and use it in GitHub Desktop.
Save dolmen/864551 to your computer and use it in GitHub Desktop.
Export all Windows Wifi profiles (SSID, password) in XML
:: Run with full administrator rights
netsh wlan export profile folder=. key=clear
@echo off
if "%~1"=="" goto :Usage
setlocal
mkdir "%~1" || exit /B 1
netsh wlan export profile "folder=%~1" key=clear >nul
:: Get current code page
for /F "tokens=2 delims=:" %%P in ('chcp') do set CP=%%P
set CP=%CP:~1%
:: Switch to UTF-8
chcp 65001 >nul
(
echo ^<?xml version="1.0" encoding="UTF-8"?^>
echo ^<WLANProfiles^>
for %%P in ("%~1\*") do echo ^<WLANProfile href="%%~nxP"/^>
echo ^</WLANProfiles^>
) > "%~1\index.xml"
:: Restore code page
chcp %CP% >nul
exit /B 0
:Usage
echo usage: %~n0 ^<directory^>
@Vlad3lou
Copy link

InBinceAble81. You will most likely help me with this. I made a code where this data should have been sent to me immediately by email, but there were errors, and so it is possible to create a file, read it and send data from them to email, for convenience, you can delete the created file after sending it to email.
I'm sorry for my English, I'm from Ukraine. @InBinceAble81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment