If it is not convenient to press CTRL+ALT+DEL (or the OS doesn't support it), type (on your Windows NT computer):
WhoLocal ComputerName
where ComputerName is the NetBIOS name of the computer you want to check.
WhoLocal.bat will echo a user=xxxxx where xxxxx is the locally logged on UserName (or null if no one is logged on locally). If UserName is logged on locally, it will set a user environment variable. You may also receive:
A session does not exist with that computer name.
which can be ignored.
WhoLocal.bat contains:
@echo off setlocal set machine=%1 set user= If \{%1\}\{\} goto syntax for /f "Tokens=*" %%i in ('net sess \\%machine%') do call :user1 "%%i" if not "%user%"
"" goto done for /f "Skip=5 Tokens=*" %%i in ('nbtstat -a %machine%') do call :user2 "%%i" :done @echo user=%user% endlocal & set user=%user% goto end :syntax @echo Syntax: WhoLocal ComputerName endlocal & set user= goto end :user1 if not "%user%""" goto end set param=%1 set param=%param:"=% set param=%param: =% set param1=%param:~0,8% if not "%param1%"
"Username" goto end set user=%param:~8,21% goto end :user2 if not "%user%"=="" goto end set param=%1 set param=%param:
0 comments
Hide comments