Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2016
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.22 KB | None | 0 0
  1. @echo off
  2. :START
  3. color 1F
  4. cls
  5. title View wireless SSID list
  6.  
  7. ::Display list of SSIDs stored in this computer and prompt user to choose one
  8. Netsh wlan show profiles
  9. Echo If you wish to view the security key for one of the above SSIDs,
  10. Set /p SSID=enter its name here:
  11. echo.
  12.  
  13. ::Detect whether the user's chosen SSID is in the list
  14. Netsh wlan show profiles | find /i "%SSID%" > NUL
  15. If errorlevel 1 (
  16.     ::warn user that SSID is not in the list, then start over
  17.     color cf
  18.     echo.
  19.     echo Sorry, that SSID is not found.
  20.     pause
  21.     goto start
  22.     )
  23.  
  24. :VIEWKEY
  25.  
  26. ::The below spacing is deliberately wide for readability of results when a security key is displayed
  27. echo     SSID                   : %SSID%
  28.  
  29. ::Display key content if available
  30. netsh wlan show profile name="%SSID%" key=clear | find "Key Content"
  31.  
  32. ::Detect whether a key was found or not.
  33. If errorlevel 1 (
  34.     ::Turn yellow and warn if a key is not found for this SSID
  35.     color 6f
  36.     echo The security key is not found for this SSID.
  37.     ) ELSE (
  38.     ::Turn green if a key is found for this SSID
  39.     color 2f)
  40. echo.
  41.  
  42. ::Give the user a chance to view another key
  43. choice /c YN /m "Do you want to view another?"
  44. If errorlevel 2 goto EXIT
  45. If errorlevel 1 goto start
  46.  
  47. :EXIT
  48. exit /b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement