(view source code of ntrole.bat as plain text)
@ECHO OFF
ECHO.
:: Check command line and Windows version
IF NOT "%1"=="" GOTO Syntax
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
:: Actual command to determine role: 1 line only
FOR /F "skip=8 tokens=2 delims=:" %%A IN ('NET ACCOUNTS') DO FOR /F "tokens=1 delims= " %%K IN ('ECHO.%%A') DO SET NTRole=%%K
:: Display result
SET NTRole
:: Done
GOTO End
:Syntax
ECHO NTRole.bat, Version 1.10 for Windows NT 4 / 2000
ECHO Find out if this batch file runs on a server or a workstation
ECHO.
ECHO Usage: %~n0
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
ECHO Inspired by one of Clay Calvert's newsgroup postings on alt.msdos.batch.nt
:End
page last modified: 2024-04-16; loaded in 0.0067 seconds