Advertisement
vartik

getmysessionid.bat

Nov 15th, 2018
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. for /f "delims=" %%s in ('query session') do (
  4.     set querysessionline=%%s
  5.     set sessionmark=!querysessionline:~0,1!
  6.     if "!sessionmark!" == ">" (
  7.         set mysessionid=!querysessionline:~41,5!
  8.         set mysessionid=!mysessionid: =!
  9.         echo !mysessionid!
  10.         exit /b !mysessionid!
  11.     )
  12. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement