?
Solved

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

Posted on 2005-04-19
6
Medium Priority
?
279 Views
Last Modified: 2013-12-04
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
Comment
Question by:CooperTupelo
  • 2
  • 2
  • 2
6 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 13818880
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
 
LVL 86

Accepted Solution

by:
jkr earned 1000 total points
ID: 13818946
>>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
 

Author Comment

by:CooperTupelo
ID: 13818970
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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 86

Expert Comment

by:jkr
ID: 13818999
>>is there anyway to pause the screen when running net view?

net view | more

or

net view > all_machines.txt

should help.
0
 

Author Comment

by:CooperTupelo
ID: 13819030
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
 
LVL 30

Expert Comment

by:Axter
ID: 13819037
>>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

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question