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

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -