@Echo off & Goto BeginBatch ************************************************ This Batch File is Copyrighted 2005 By Ozzy_98 If may be used or changed in anyway way the end user wishes. If given away, please list myself somewhere in credits for this batch file. Please Diable Word Wrap When Viewing. ************************************************ :BeginBatch SetLocal Set Number_Of_IP_Addresses=0 cls :DefaulOptions Set ShowIPWhenFound=True :: This Shows the IP Addresses as they are found. Can cause flicker slowdown Set PingTimeOut=50 :: This is how long it waits for ping reply untill it pings the next host. Adjust this higher for internet use. Lower for local use. Set Range=255 :: Default Range to Ping :SwitchOptions :: These Options Are Used Control ParamStrings If "%1"=="" goto GetParamEnd :GetParam Set TempParam=%1 if "%1"=="%TempParam%" set TempParam=%TempParam:~0,2% if /I "%TempParam%"=="/a" goto :About if /I "%TempParam%"=="/?" goto :Usage if /I "%TempParam%"=="/i" goto :ParamIP :GetParamEnd Goto GetCurrentIP :ParamIP For /F "Tokens=2,3,4,5 Delims=.:" %%a in ("%1") do ( Set IP_A=%%a Set IP_B=%%b Set IP_C=%%c Set IP_D=%%d Goto FindTheSubnetMask ) goto end Goto GetCurrentIP :Usage Echo. Echo Batch Ping And NSLookup Echo. Echo %0 Usage: Echo /a = About Menu Echo /IP: = Set Network IP Address Example: IP /IP:192.168.0.2 Goto end :About Echo ************************************************ Echo This Batch File is Copyrighted 2004 By Ozzy_98 Echo If may be used or changed in anyway way the Echo end user wishes. If given away, please list Echo myself somewhere in credits for this batch file. Echo Please Diable Word Wrap When Viewing. Echo ************************************************ Goto End :GetCurrentIP ipconfig | find "IP Add"> iptemp for /f "Tokens=3,4,5,6 Delims=.: " %%a in (iptemp) do ( Set IP_A=%%a Set IP_B=%%b Set IP_C=%%c Set IP_D=%%d ) del iptemp :FindTheSubnetMask ipconfig | find "Subnet"> iptemp for /f "Tokens=3,4,5,6 Delims=.: " %%a in (iptemp) do ( Set /a Number_Of_IP_Addresses += 1 Set Network=%IP_A% if "%%b"=="255" (set network=%IP_A%.%IP_B%) if "%%c"=="255" (set network=%IP_A%.%IP_B%.%IP_C%) if "%%d"=="255" (set network=%IP_A%.%IP_B%.%IP_C%.%IP_D%) Set Sub_A=%%a Set Sub_B=%%b Set Sub_C=%%c Set Sub_D=%%d ) del iptemp :CheckForMoreThenOneIP if %Number_Of_IP_Addresses% leq 0 goto end Echo Autoconfiguration Error....... Echo. Echo Number of IP Addresses . . . . . . . . . . . : %Number_Of_IP_Addresses% Echo Using IP Address . . . . . . . . . . . . . . : %IP_A%.%IP_B%.%IP_C%.%IP_D% Echo Using Subnet Mask. . . . . . . . . . . . . . : %Sub_A%.%Sub_B%.%Sub_C%.%Sub_D% Echo Current Network. . . . . . . . . . . . . . . : %Network% :ChoiceLoop Echo. Set /p Choice=Do you wish to manualy set an ip address\subnet (y/n/quit)? if "%Choice:~0,1%"=="y" goto ManualSetIP if "%Choice:~0,1%"=="n" goto Ping if "%Choice:~0,1%"=="q" goto end goto ChoiceLoop :ManualSetIP Echo. :FirstIP Set /P IP_A=Please Enter The First Octet of your IP Address: if %IP_A% gtr 255 goto :FirstIP if %IP_A% lss 1 goto :FirstIP :SecondIP Set /P IP_B=Please Enter The Second Octet of your IP Address: if %IP_B% gtr 255 goto :SecondIP if %IP_B% lss 0 goto :SecondIP :ThirdIP Set /P IP_C=Please Enter The Third Octet of your IP Address: if %IP_C% gtr 255 goto :ThirdIP if %IP_C% lss 0 goto :ThirdIP :FourthIP Set /P IP_D=Please Enter The Fourth Octet of your IP Address: if %IP_C% gtr 255 goto :FourthIP if %IP_C% lss 0 goto :FourthIP Set /p Choice=Is %IP_A%.%IP_B%.%IP_C%.%IP_D% correct? if "%Choice:~0,1%"=="y" goto Ping goto FirstIP :Ping CLS For /l %%l in (200,1,210) do ( Ping -n 1 -w 50 %Network%.%%l | find "TTL">>IPTemp cls Echo Pinging %Network%.%%l Type IPTemp ) :NSLookup for /f "Tokens=3,4,5,6 delims=.: " %%a in (iptemp) do ( nslookup %%a.%%b.%%c.%%d 2> nserror.txt | find "Name" > temp for /f "tokens=2 Delims=: " %%Q in (temp) do Echo Name: %%Q >> Output.txt & Echo IP Address: %%a.%%b.%%c.%%d >>Output.txt & Echo. >>Output.txt ) :ShowResults cls Echo Addresses Found: Type Output.txt Echo Addresses Found With No DNS Entrys: for /f "tokens=5 delims=: " %%a in (nserror.txt) do echo %%a :End