Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for hostname.bat

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

  1. @ECHO OFF
  2. ECHO.
  3. IF [%1]==[] GOTO Syntax
  4. ECHO.%1 | FIND "?" >NUL
  5. IF NOT ERRORLEVEL 1 GOTO Syntax
  6. FOR /F "tokens=2 delims= " %%A IN ('PING -a %1 -n 1 ^| FIND "[%1]"') DO ECHO.%%A
  7. GOTO:EOF
  8.  
  9. :Syntax
  10. ECHO HostName, Version 1.10 for Windows NT
  11. ECHO Find host name for specified IP address
  12. ECHO.
  13. ECHO Usage:  HOSTNAME  ^<IP_address^>
  14. ECHO.
  15. ECHO Idea by Marcel van der Wal
  16. ECHO Written by Rob van der Woude
  17. ECHO http://www.robvanderwoude.com
  18.  

page last uploaded: 2017-04-06, 13:33