On CBS.com: U2 on Letterman: All week, every day

Create an IP address tracking batch tool in Windows XP Pro

Tags: NETWORKING, tool, Greg Shultz, IP address, IP, Microsoft Windows XP, Microsoft Windows, Do Ping.exe, Microsoft Windows XP Professional, Windows XP Tips Newsletter

  • Save
  • Print
  • Recommend
  • 12

Takeaway: Finding your network's free IP addresses in Windows XP Pro can work a little too well, giving you more entries than you can easily manage. Here's how to narrow your search for unused IP addresses and output the results to a short, easy-to-read text file.

When you're troubleshooting DHCP problems in Windows XP Pro and want to find out which addresses in a range of IP addresses aren't in use, you may open a command prompt window and launch a ping loop with the For…In…Do command. For example, to find out which IP addresses aren't being used in the range 192.168.1.1 to 192.168.1.100, you might use the command For /L %f in (1,1,100) Do Ping.exe -n 2 192.168.1.%f.

This command will report all the IP addresses, whether in use or not; you'll also have to scroll through a vast number of entries on the command line. You can avoid these inconveniences with a short batch file that returns only those IP addresses that aren't in use, and then compiles the results in a text file. Here's how:

  1. Launch Notepad and type the following commands:
    @Echo off
    date /t > IPList.txt
    time /t >> IPList.txt
    echo =========== >> IPList.txt
    For /L %%f in (1,1,100) Do Ping.exe -n 2 192.168.1.%%f | Find
    "Request timed out." && echo 192.168.1.%%f Timed Out >>
    IPList.txt && echo off
    cls
    Echo Finished!
    @Echo on
    Notepad.exe IPList.txt
  2. Save the file as IPTracker.bat and close Notepad.

Keep in mind that the entire For…In…Do command consists of several commands strung together with &&s. The command begins with the word For and ends with the word off, and the entire command must be on one line. Also, be sure to replace the example numbers with numbers from the IP addresses you wish to track.

Now when you troubleshoot a DHCP problem, you can locate and double-click the IPTracker.bat file in Windows Explorer, and then launch an IP address tracking tool batch that will find only those addresses that aren't in use and then display the results in Notepad. (In this case, the saved batch file becomes an IP address tracking tool that can be created once and used over and over.)

Note: This tip applies only to Windows XP Professional.

Miss a tip?

Check out the Windows XP archive, and catch up on our most recent Windows XP tips.

Stay on top of the latest XP tips and tricks with our free Windows XP newsletter, delivered each Thursday. Automatically sign up today!

  • Save
  • Print
  • Recommend
  • 12

Print/View all Posts Comments on this article

Find Error mitch_marcotte@... | 03/21/07
Error: Parameter format not correct xpgpx@... | 03/21/07
OUCH!!!!! juan18_c@... | 03/21/07
Question juan18_c@... | 03/21/07
Make it Faster KenDAWG | 03/22/07
Start with For end with off nazeemjansen@... | 03/22/07
Worked for me ddevenesan@... | 03/22/07
Worked for me tom.armes@... | 03/23/07
Notepad Settings Jorge Alexandres | 03/22/07
I get error as well Bob Oso | 03/22/07
Do your own editing rpost@... | 03/22/07
Yes i too marsatkhed1@... | 03/26/07
Dont even Bother carl0ski@... | 03/21/07
Freeware can do. philip_lee@... | 03/22/07
Don't see any free IP addresses paul.eggers@... | 03/22/07
Totally longwinded and over the top elrico-fantastica | 03/26/07
Totally longwinded and over the top Mike@... | 03/28/07
IPtracker.bat don@... | 03/22/07
OR logic use || sign essar.max@... | 03/22/07
Really... on 1 line? BamSec1@... | 03/22/07
Missing the point Chris_Muncy | 03/25/07
Not OR Logic, it's a PIPE command ESchlangen | 03/26/07
This works - Thanks Essar.Max Professor-X | 06/18/07
Why reinvent the wheel - Advanced IP Scanner iainwrig@... | 03/22/07
If you receive an error message... Greg Shultz | 03/21/07
Trimming Batch file jan.ostlund@... | 03/22/07
This one works... Lost Cause? | 03/22/07
This one worked... D.H. Cesare | 03/22/07
Jan script works very good deqani@... | 03/23/07
tnx sheoul_08@... | 03/27/07
Worked fine - Got stuck thomasdohling@... | 04/18/07
If you receive an error message... dondreak | 12/03/08
Freeware can do philip_lee@... | 03/22/07
Another freeware jjarvis@... | 03/22/07
Cool Tool holly.gibson@... | 03/22/07
Thanks for sharing Jorge Alexandres | 03/22/07
I use this too iainwrig@... | 03/22/07
Thanks uberg33k50 | 03/22/07
Nice Thanks! mikec@... | 03/22/07
What about DHCP leases of PCs switched off?? iain.marshall@... | 03/22/07
Why audit DHCP with a script? belbinclive@... | 03/22/07
Re: Why audit DHCP with a script? iain.marshall@... | 03/22/07
Agree with Iain Jorge Alexandres | 03/22/07
Other NOS's T0nz | 03/27/07
Re: Why audit DHCP with a script? belbinclive@... | 03/22/07
IP address tracking batch tool available for Win2K? Questor1 | 03/22/07
should work for w2k bigmenace1ster@... | 03/22/07
No excuse for this at a tech site defo1 | 03/24/07
No excuse for this post Mike@... | 03/28/07
Nice reply lawrence@... | 05/15/07
It is scary... No name specified | 05/26/07
Here is the PowerShell Version jdelatorre@... | 03/22/07
Umm dechiarag@... | 03/23/07
works for Windows 2000 nhuffnagle@... | 03/26/07
FIND: Parameter format not correct thomasdohling@... | 04/18/07
read previous posts tektom | 05/16/07
RE: Create an IP address tracking batch tool in Windows XP Pro davejohnson@... | 07/13/07
Create an IP address tracking batch tool in Windows XP Pro MarkJL0@... | 07/14/07
RE: Create an IP address tracking batch tool in Windows XP Pro MarkJL0@... | 07/14/07
RE: Create an IP address tracking batch tool in Windows XP Pro SysAdminII | 02/14/08

What do you think?

White Papers, Webcasts, and Downloads

Article Categories

Security
Security Solutions, IT Locksmith
Networking and Communications
E-mail Administration NetNote, Cisco Routers and Switches
CIO and IT Management
Project Management, CIO Issues, Strategies that Scale
Desktops, Laptops & OS
Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
Data Management
Oracle, SQL Server
Servers
Windows NT, Linux NetNote, Windows Server 2003
Career Development
Geek Trivia
Software/Web Development
Web Development Zone, Visual Basic, .NET

SmartPlanet

advertisement
Click Here