Return to Snippet

Revision: 63720
at June 1, 2013 21:57 by mikaelpelle


Initial Code
@echo off
cls
echo.Domain Name IP Address Lookup
echo.-----------------------------
echo.(c) mikaelpelle.com
:userchoice
echo.
echo.
set choice=
set IP=
set /p choice=Enter the website address: 
set choice=%choice:http://=%
for /f "tokens=1,2 delims=/" %%a in ("%choice%") do set domainhost=%%a & set domainpath=%%b
for /f "skip=1 tokens=2 delims=[]" %%* in ('ping.exe -n 1 %domainhost%') do (set "IP=%%*" & goto:check)
:check
if not %IP%.==. goto displayip
if %IP%.==. goto displayerror
:displayip
echo.The web server IP is: %IP%
goto end
:displayerror
echo.Error: the host %domainhost% does not exist
goto end
:end
echo.
pause
goto userchoice

Initial URL

                                

Initial Description
Return the IP address from a domain name.

Initial Title
Domain Name IP Address Lookup

Initial Tags
ip

Initial Language
DOS Batch