rem Dumb batch file to overcome problem of DOS variables rem not being exportable, thus not allowing changes between separate cmd shells rem specifically this manages only one specific counter but could easily be extended rem call as setsessid.bat val where val is 1,2 or -1,-2 etc to change the value rem of the session variable count or 0 to return the current value echo off set FSESS=sess.id echo processing %1 :setval for /f "tokens=*" %%I in (%FSESS%) do set NOWSESS=%%I set /a NOWSESS=%NOWSESS%+%1 echo %NOWSESS% > %FSESS% :eof echo "at %NOWSESS%" exit /B %NOWSESS%