Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Grab batch prompt context and put it in a variable  (Read 3191 times)

0 Members and 1 Guest are viewing this topic.

zask

    Topic Starter


    Intermediate

    • Experience: Experienced
    • OS: Other
    Grab batch prompt context and put it in a variable
    « on: December 09, 2015, 11:14:16 PM »

    favorite
    i took this command to grab a profile and place its name in a variable

    for /f "tokens=4 delims=: " %%A in ('netsh wlan show profiles') do set "profile=%%A"
    now i added this to the next line;

    netsh wlan show profiles "%profile%" key=clear
    then something that says "key content" (must be administrator) should appear with a wifi password next to it, how do i get that password to also go into a variable? i tried doing something like this but it just displays the word "such" for some strange reason...

    for /f "tokens=4 delims=: " %%A in ('netsh wlan show profiles') do set "profile=%%A
    for /f "tokens=4 delims=: " %%A in ('netsh wlan show profiles "%profile%" key=clear') do set "profile2=%%A"

    echo %profile2%