@ECHO OFF
SETLOCAL
ECHO.
IF [%1]==[] GOTO Syntax
IF NOT [%2]==[] GOTO Syntax
ECHO.%1 | FIND "?" >NUL
IF NOT ERRORLEVEL 1 GOTO Syntax

FOR /F "tokens=1* delims=\ " %%A IN ('ECHO.%1') DO SET server=%%A
SRVINFO -ns \\%server% | FIND /I "System Up Time:"
GOTO End

:Syntax
ECHO UpTime,  Version 1.00 for Windows NT
ECHO Show how long a system has been up and running
ECHO.
ECHO Usage:  %~n0  [ ^<server_name^> ]
ECHO.
ECHO Needs SRVINFO from the NT4 Server Resource Kit

:End
ENDLOCAL
Published in: Batch
Download

Related snippets