Output batch commands to a batch file which will set your variables. Later you can use the call command to invoke that batch file and get your variables back. Example 1:
@echo off
echo set myvar=my first value>vars.bat
echo set myvar2=my second value>>vars.bat
echo set myvar3=my third value>>vars.bat
call vars.bat
echo %myvar%
echo %myvar2%
echo %myvar3%
pause
exit
Example 2:
@echo off
if not exist vars.bat (
type nul>vars.bat
)
:menu
cls
echo 1) Make new variable
echo 2) View a variable
echo.
set /p cin=Select option:
if %cin%==1 goto mkvar
if %cin%==2 goto getvar
goto menu
:mkvar
cls
set /p var=Enter variable name:
set /p val=Enter value:
echo set %var%=%val%>>vars.bat
goto menu
:getvar
cls
if exist vars.bat call vars.bat
cls
set /p var=Enter variable name:
setlocal enabledelayedexpansion
echo Value of %var% is !%var%!
endlocal
pause
goto menu