Hey guys my name is droidkid, i'm working on a script to do with changing dns. here is an example of my problem

Code:
@Echo Off
For /f "skip=2 tokens=4*" %%a In ('NetSh Interface IPv4 Show Interfaces') Do (
    Call :UseNetworkAdapter %%a "%%b"
)


:UseNetworkAdapter
:: %1 = State
:: %2 = Name (quoted); %~2 = Name (unquoted)
If "%1"=="connected" (
    :: Do your stuff here, for example:
    Echo %~2
)

exit /B

echo.
echo Hey this is the end of the script
my problem is it closes the window and dose not display the last echo output. (this is just an example of my problem) however if i remove the exit /B the script will not run properly? its so odd I want to be able to read the echo %~2 but instead it closes right away?