сейчас ошибки нет. НО!!! в обоих случаях запускается второй батник
Код:
@Echo Off
Set TUser=User1
Set TServer=%ComputerName%
For /F "Skip=1 UseBackQ" %%i In (`WMIC /NODE:"%TServer%" UserAccount Where 'Name Like "%TUser%"' Get Disabled`) Do Set UserDisabled=%%i
Call :GetUserSession "%TUser%" "%TServer%"
If %UserSession% EQU 0 If /I "%UserDisabled%"=="TRUE" Call e:\1.bat&GoTo CONT
Call e:\2.bat
:CONT
EXIT
:GetUserSession
:: ------------
:: IN : %1 - User Name
:: %2 - Server Name
:: OUT: %UserSession%
For /F "Tokens=1-4 Skip=3 Delims=# " %%i In ('qwinsta /Server:"%~2"') Do (
If /I "%%i"=="rdp-tcp" If /I "%%k"=="%~1" Set UserSession=%%l&GoTo :EOF
If /I "%%i"=="%~1" Set UserSession=%%j&GoTo :EOF
)
Set UserSession=0&GoTo :EOF