Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for manage.bat

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

  1. @ECHO OFF
  2. :: Check for correct Windows version
  3. IF NOT "%OS%"=="Windows_NT"         GOTO Syntax
  4. VER | FIND.EXE "Windows NT" >NUL && GOTO Syntax
  5.  
  6. :: Check for correct number of command line arguments
  7. IF     "%~1"=="" GOTO Syntax
  8. IF NOT "%~2"=="" GOTO Syntax
  9.  
  10. :: Check validity of command line argument
  11. ECHO.%1 | FINDSTR.EXE /R /C:"[\\/?]"      >NUL && GOTO Syntax
  12. PING.EXE %~1 -n 2 2>NUL | FIND.EXE "TTL=" >NUL || GOTO Syntax
  13.  
  14. :: The actual command
  15. START %windir%\System32\COMPMGMT.MSC /COMPUTER=\\%~1
  16.  
  17. :: Done, exit with last errorlevel
  18. EXIT /B %ERRORLEVEL%
  19.  
  20.  
  21. :Syntax
  22. ECHO.
  23. ECHO Manage.bat,  Version 1.00 for Windows 2000 and later
  24. ECHO Open a Computer Management Console for the specified remote computer.
  25. ECHO.
  26. ECHO Usage:  MANAGE  remote_computer_name
  27. ECHO.
  28. ECHO Where:         "remote_computer_name" is the computer to be managed
  29. ECHO.
  30. ECHO Written by Rob van der Woude
  31. ECHO http://www.robvanderwoude.com
  32. EXIT /B 1
  33.  

page last modified: 2024-04-16; loaded in 0.0081 seconds