Powered by GeSHi

Source code for uptime.bat

(view source code of uptime.bat as plain text)

  1. @ECHO OFF
  2. SETLOCAL
  3. ECHO.
  4. IF [%1]==[] GOTO Syntax
  5. IF NOT [%2]==[] GOTO Syntax
  6. ECHO.%1 | FIND "?" >NUL
  7. IF NOT ERRORLEVEL 1 GOTO Syntax
  8.  
  9. FOR /F "tokens=1* delims=\ " %%A IN ('ECHO.%1') DO SET server=%%A
  10. SRVINFO -ns \\%server% | FIND /I "System Up Time:"
  11. GOTO End
  12.  
  13. :Syntax
  14. ECHO UpTime,  Version 1.00 for Windows NT
  15. ECHO Show how long a system has been up and running
  16. ECHO.
  17. ECHO Usage:  %~n0  [ ^<server_name^> ]
  18. ECHO.
  19. ECHO Needs SRVINFO from the NT4 Server Resource Kit
  20.  
  21. :End
  22. ENDLOCAL
  23.