session - Batch Programming - comparing string -


i want perform action selected group of people tried writing batch command work in performing action group of people added if condition pick people begin string name. please find below code. somehow working.

setlocal enabledelayedexpansion  query session >session.txt  /f "skip=2 tokens=2," %%i in (session.txt) ( set _prefix=%i:~0,6%  if %_prefix%==myuser (     logoff %%i     ) )  del session.txt  endlocal   output of query session :    sessionname       username                 id  state   type        device  services                                    0  disc >console           myuser01                 1  active 

there can multiple session myuser02,myuser03 , on

for /f "tokens=1,2*" %%a in ('qwinsta^|find /i "myuser"') (       logoff %%b ) 

may easier?


Comments

Popular posts from this blog

java - BeanIO write annotated class to fixedlength -

Using Java 8 lambdas/transformations to combine and flatten two Maps -

How to connect android app to App engine -