a.bat
· 638 B · Batchfile
Eredeti
echo OFF
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
echo.%* | FIND "?" >NUL
IF NOT ERRORLEVEL 1 GOTO Syntax
IF NOT [%2]==[] GOTO Syntax
setlocal
SET WSS=
IF NOT [%1]==[] FOR /F "tokens = 1 delims = \ " %%A IN ('ECHO.%~1') DO SET WSS = %%A
FOR /F "tokens = 1 delims = \ " %%a IN ('NET VIEW ^| FIND /I "\\%WSS%"') DO FOR /F
"tokens = 1 delims = " %%A IN ('NBTSTAT -a %%a ^| FIND /I /V "%%a" ^| FIND "<03>"')
DO ECHO.%%a %%A
ENDLOCAL
GOTO:EOF
ECHO Display logged on users and their workstations.
ECHO Usage: ACTUSR [ filter ]
IF "%OS%"=="Windows_NT" ECHO Where: filter is the first part
of the computer name^(s^) to be displayed
1 | echo OFF |
2 | IF NOT "%OS%"=="Windows_NT" GOTO Syntax |
3 | echo.%* | FIND "?" >NUL |
4 | IF NOT ERRORLEVEL 1 GOTO Syntax |
5 | IF NOT [%2]==[] GOTO Syntax |
6 | setlocal |
7 | SET WSS= |
8 | IF NOT [%1]==[] FOR /F "tokens = 1 delims = \ " %%A IN ('ECHO.%~1') DO SET WSS = %%A |
9 | FOR /F "tokens = 1 delims = \ " %%a IN ('NET VIEW ^| FIND /I "\\%WSS%"') DO FOR /F |
10 | "tokens = 1 delims = " %%A IN ('NBTSTAT -a %%a ^| FIND /I /V "%%a" ^| FIND "<03>"') |
11 | DO ECHO.%%a %%A |
12 | ENDLOCAL |
13 | GOTO:EOF |
14 | ECHO Display logged on users and their workstations. |
15 | ECHO Usage: ACTUSR [ filter ] |
16 | IF "%OS%"=="Windows_NT" ECHO Where: filter is the first part |
17 | of the computer name^(s^) to be displayed |