• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 284
  • Last Modified:

Batch file to ping many pc names on network with leading zeros.

I am currently an intern at a medium sized business that has about 550 PCs that have names ranging from tw0001 - tw05**.  I want to write a batch file that will ping every possible name within the range of tw0001 - tw05**.  I am trying to see if any PCs exist that are not in our records.  This is what I have so far...

FOR /L %%i IN (1,1,550) DO PING -n 1 tw000%%i >> pingresults.txt

The problem with this is when %%i reaches 10, it starts pinging tw00010 where it should be tw0010.  Is there anyway to force the variable
%%i to four digits filled with leading zeros?  Also, is there anyway to limit the reults in the pingresults.txt to only those that fail?  If neither of these are not possible, then c++ is my next option.  I have not begun to write this in c++ yet but any suggetsions would be great.  Thanks in advance.

-Chris
0
CooperTupelo
Asked:
CooperTupelo
  • 2
  • 2
  • 2
1 Solution
 
AxterCommented:
Hi CooperTupelo,
Check out the following link:
http://www.webattack.com/get/superscan.shtml

Using the above free program you can ping computers in your local network.

David Maisonave :-)
Cheers!
0
 
jkrCommented:
>>I am trying to see if any PCs exist that are not in our records

Well, then pinging all the names that *are* in your records does not seem to be the way to go . I'd suggest to

net view

on the command line and see whether there are PCs that are *not* named tw0001 - tw05**...
0
 
CooperTupeloAuthor Commented:
Thanks Axter, that program is pretty good.  JKR, is there anyway to pause the screen when running net view?  I tried using /p, like when using the dir command, but that does not work.
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
jkrCommented:
>>is there anyway to pause the screen when running net view?

net view | more

or

net view > all_machines.txt

should help.
0
 
CooperTupeloAuthor Commented:
Yes, that is excellent.  This was my first question to post and I was not expecting responses this fast.  i am impressed.  Thanks both of you.
0
 
AxterCommented:
>>that program is pretty good.

It's pretty good for a free program.  I used it to find all the computers in my local network that had a VNC server running.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now