Home > Articles, Microsoft Desktop, Microsoft Server > Find All Active/Used IP Addresses on Your Network

Find All Active/Used IP Addresses on Your Network

There is a really neat way that you can quite easily find all active/used IP Addresses on your network without the need for any third party applications or worse, pinging each IP Address individually.

Open the Command Prompt and type in the following:

FOR /L %i IN (1,1,254) DO ping -n 1 192.168.10.%i | FIND /i “Reply”>>c:\ipaddresses.txt

Change 192.168.10 to match you own network.

By using -n 1 you are asking for only 1 packet to be sent to each computer instead of the usual 4 packets.

The above command will ping all IP Addresses on the 192.168.10.0 network and create a text document in the C:\ drive called ipaddresses.txt.  This text document should only contain IP Addresses that replied to the ping request.

Although it will take quite a bit longer to complete, you can also resolve the IP Addresses to HOST names by simply adding -a to the ping command.

FOR /L %i IN (1,1,254) DO ping -a -n 1 192.168.10.%i | FIND /i “Reply”>>c:\ipaddresses.txt

GUI Based Discovery

If you’re not confident using the command prompt, there are alternative GUI based applications that you can use.

TCPNetView – No installation is required, simply double-click the executable and away it goes.  It will find all active IP Addresses on the subnet you are currently connected too.
- Download Here

Advanced IP Scanner – If you are after something with a few more options and features, Advanced IP Scanner is an excellent free utility.
- More Information Here

  1. Jeb
    June 21st, 2008 at 02:17 | #1

    Sample output problem for me:

    C:\>ping -n 1 192.168.10.1 | FIND /i “Reply” 1>>c:\ipaddresses.txt
    FIND: Parameter format not correct

    WinXP Pro SP3 gives me an error. I’m not sure how the number 1 gets put after “Reply” string in the command by the For loop but it does and breaks it.

  2. me too
    August 8th, 2008 at 03:10 | #2

    ANY HELP WOULD BE NICE? seems like the FIND Comand “reply” comes back with a parameter ERROR I really would like to know how to make this work. Thanks in advance

  3. August 8th, 2008 at 17:54 | #3

    hmmm – working fine for me.

    perhaps try wrapping the quotes around “Reply” in more quotes…

    e.g. find /i “”"Reply”"”

    see if that makes any difference.

  4. September 12th, 2008 at 04:16 | #4

    please I’m looking for a command that i can type the cmd+ipaddress in the dos screen then return the computer name

  5. September 15th, 2008 at 16:53 | #5

    Maybe try:

    nbtstat -A ipaddress

    or check out the nslookup command.

  6. susi
    June 23rd, 2009 at 15:10 | #6

    Sample output problem for me:
    C:\>ping -n 1 192.168.10.1 | FIND /i “Reply” 1>>c:\ipaddresses.txt
    FIND: Parameter format not correct
    WinXP Pro SP3 gives me an error. I’m not sure how the number 1 gets put after “Reply” string in the command by the For loop but it does and breaks it.

  7. frank
    July 16th, 2009 at 19:36 | #7

    Replace the “ with ” and it will work (just delete them from the command and type them again).

  8. frank
    July 16th, 2009 at 19:39 | #8

    Sorry, when posting the character ” changes. So replace the ” character before and after the Reply with the double quote character. On my keyboard is above the comma ,

  9. sharma
    August 25th, 2009 at 01:10 | #9

    which command is used to show all ip in lan in cmd

  10. Thomas Davenport
    November 30th, 2009 at 22:19 | #10

    That is brilliant. Thank you very much.
    Regards
    Tom

  11. Simon
    January 10th, 2010 at 11:34 | #11

    @me too
    Your copy and paste of the command probably included smart quotes – paste your copy of the command into notepad and replace the “ ” and with ” s.

  12. George
    February 4th, 2010 at 20:56 | #12

    Try

    nmap -sP 192.168.10.0/24

    It’s simple and will tell you all the machines that are up in an instant

  13. Thanks
    July 31st, 2010 at 06:45 | #13

    hm,, little slow but great batch script. thanks man

  14. July 31st, 2010 at 21:21 | #14

    am still having aproble with the codeC:\>ping -n 1 192.168.10.1 | FIND /i “Reply” 1>>c:\ipaddresses.txt
    FIND: Parameter format not correct what should i do?????????????

  15. Justin
    October 8th, 2010 at 23:20 | #15

    @Jeb
    Paste the command in a text editor and delete and re-add the quotes. The quotes you copy are some HTML encoded double quote.

  16. May 23rd, 2011 at 17:56 | #16

    Make sure to leave a space before and after the redirection operator >>
    This will do:
    FOR /L %i IN (1,1,254) DO ping -n 1 192.168.10.%i | FIND /I “Reply” >> c:\ipaddresses.txt

  17. lina
    July 13th, 2011 at 11:52 | #17

    how do you do this on a mac?

  18. Alex
    August 10th, 2011 at 13:05 | #18

    I know I have the administrative privileges, but I still get “access denied”.
    Windows 7.

    C:\Users\Alex>for /l %i in (1,1,254) do ping -n 1 192.168.1.%i | find /i “reply”
    >>c:\ipaddress.txt

    C:\Users\Alex>ping -n 1 192.168.1.1 | find /i “reply” 1>>c:\ipaddress.txt
    Access is denied.

  19. NISHANT SINHA
    September 1st, 2011 at 21:37 | #19

    try arp -a :)

  20. hector
    September 27th, 2011 at 13:13 | #20

    I get an access denied error

  21. hector
    September 27th, 2011 at 13:16 | #21

    the nmap one gives me: ‘nmap’ is not recognized as an internal or external command, operable program or batch file.

  22. Chris
    October 13th, 2011 at 13:42 | #22

    I used the
    FOR /L %i IN (1,1,254) DO ping -n 1 192.168.10.%i | FIND /I “Reply” >> c:\ipaddresses.txt

    and I get an error that goes by so quick I can’t see it. Can someone please attempt this in a batch and resolve the issue. I actually have commands that find the IP address and gatewa and save them to variables, I pass that into this code (instead of the 192.168.10.%1) but I need to remove the last octect. (don’t know how to do that either.) I don’t need to pass it into a file, just display the used IPs and resolve the name ( -a)
    Would someone please put that in a batch and test it? This is a server test utility to see if the DNS is working.

  23. Chris
    October 13th, 2011 at 14:20 | #23

    I came up with this. I need to find a way to show all IPs being used too.

    @echo off

    color 0A
    cls
    :ipaddress
    ::Get IP address and save it to ip
    for /f “tokens=1-2 delims=:” %%a in (‘ipconfig^|find “IP Address”‘) do set ip=%%b
    set ip=%ip:~1%

    :gateway
    ::Get Gateway address and save it to gateway
    for /f “tokens=1-2 delims=:” %%a in (‘ipconfig^|find “Gateway”‘) do set gateway=%%b
    set gateway=%gateway:~1%

    :DNS
    ::Get Gateway address and save it to gateway
    for /f “tokens=1-2 delims=:” %%a in (‘ipconfig^|find “DNS”‘) do set dns=%%b
    set dns=%dns:~1%

    cls
    echo Your IP address is %ip%
    echo Your router address is %gateway%
    echo Your DNS address is %dns%
    echo Your computers name is %computername%
    pause

    ::cls
    ::ipconfig /all
    ::pause

    cls
    echo Now ping the gateway first
    ping %gateway% -a
    pause

    cls
    echo Now ping the ipaddress and see if the DNS is working
    echo If you don’t see the computer’s name then the DNS isn’t resolving host names
    ping %ip% -a
    pause

    cls
    ::enter the command for this computer’s name
    echo edit this file to include the code for this computer’s name
    pause

    goto ipaddress
    :end

  24. October 21st, 2011 at 21:12 | #24

    i get a “access denied” after typing FOR /L %i IN (1,1,254) DO ping -n 1 192.168.10.%i | FIND /I “Reply” >> c:\ipaddresses.txt … any suggestions what to do? thx.

  25. phil
    November 30th, 2011 at 03:31 | #25

    Under Windows Vista, 7 & Server 2008 you need to run this from an elevated command prompt, otherwise you’ll get the ‘Access Denied’ error. To do this, right-click on Command Prompt and select ‘Run as administrator’.

  26. ssppuunn
    December 8th, 2011 at 22:46 | #26

    jay, et al., if you do not have permission to write to your root directory, try:

    @echo off & For /L %%i in (1,1,255) do @ping -n 1 192.168.10.%%i | find “Request” >nul & if errorlevel 1 @echo 192.168.10.%%i >> %USERPROFILE%\Desktop\ipaddresses.txt

    Alternately, you could put the above command in a bat or cmd file and test for any subnet on the command line. Open up notepad and save the following…

    @echo off & For /L %%i in (%4,1,255) do @ping -n 1 %1.%2.%3.%%i | find “Request” >nul & if errorlevel 1 @echo %1.%2.%3.%%i >> %USERPROFILE%\Desktop\ipaddresses.txt

    … into a file which you save as SUBSCAN.CMD or [your_filename].bat or whatever (using .bat or .cmd extension in WinXP & up), and save the file somewhere in your PATH folders (to find these use the PATH command on the command line — usually C:\WINDOWS and C:\WINDOWS\System32 are fine). Then type:

    subscan 192 168 10 0

    to run the batch file. Note that you are replacing all dots (“.”) with spaces
    (” “).

    Enjoy!

  27. ssppuunn
    December 8th, 2011 at 23:04 | #27

    Apologies, that first one should be:

    @echo off & For /L %i in (1,1,255) do @ping -n 1 192.168.10.%%i | find “Request” >nul & if errorlevel 1 @echo 192.168.10.%i >> %USERPROFILE%\Desktop\ipaddresses.txt

    I had %%i incorrectly before which should be %i. The %%i in the second one is correct since it is in a batch file.

    Oh, and the arp -a command only gives you your computer’s IPs, which you can get with ipconfig /all as well.

    There is also a program called “Advanced IP Scanner (v2.1.200)” which you can download free from radmin.com if you prefer a GUI. It shows IPs/NETBIOS names in your subnets and has some options.

    Enjoy!

  28. LAB30
    December 9th, 2011 at 05:29 | #28

    Is there a way to input all of my IP ranges/subnets into this command or any other and get the same results. Looking for away to get all in use IPs on my network which has both XP/WIN 7 OS’s.

  29. Tom
    December 25th, 2011 at 14:10 | #29

    @jay
    before opening command prompt, right click and select open as administrator.

  30. programmer impossible
    July 13th, 2012 at 07:12 | #30

    go to cmd and follow this:
    1.write>>: tracert http://www.google.com

    find all ip addresses working or existing at that time
    100% for me

  31. Patrick
    November 14th, 2012 at 09:03 | #31

    arp -a worked on my macbook pro early 2008@lina

  1. No trackbacks yet.