Domain Name IP Address Lookup


/ Published in: DOS Batch
Save to your folder(s)

Return the IP address from a domain name.


Copy this code and paste it in your HTML
  1. @echo off
  2. cls
  3. echo.Domain Name IP Address Lookup
  4. echo.-----------------------------
  5. echo.(c) mikaelpelle.com
  6. :userchoice
  7. set choice=
  8. set IP=
  9. set /p choice=Enter the website address:
  10. set choice=%choice:http://=%
  11. for /f "tokens=1,2 delims=/" %%a in ("%choice%") do set domainhost=%%a & set domainpath=%%b
  12. for /f "skip=1 tokens=2 delims=[]" %%* in ('ping.exe -n 1 %domainhost%') do (set "IP=%%*" & goto:check)
  13. :check
  14. if not %IP%.==. goto displayip
  15. if %IP%.==. goto displayerror
  16. :displayip
  17. echo.The web server IP is: %IP%
  18. goto end
  19. :displayerror
  20. echo.Error: the host %domainhost% does not exist
  21. goto end
  22. :end
  23. goto userchoice

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.