Why output to a text if you can query text in memory
 Code:
for /F "usebackq skip=1 tokens=2" %i in (`query session`) DO echo %i