Use %1 to ping a list of hosts

  • Thread starter Thread starter Nic
  • Start date Start date
N

Nic

Trying to ping an ever changing list of hosts by means of
the %1 variable...

Please advise,

Nic

Batch file contents

Ping %1 hosts.txt >> hostresp.tst
 
Trying to ping an ever changing list of hosts by means of
the %1 variable...

Please advise,

Nic

Batch file contents

Ping %1 hosts.txt >> hostresp.tst


Batch contents:

For /f "Tokens=*" %%p in (hosts.txt) do ping %%p>>hostresp.txt

or

For /f "Tokens=*" %%p in ('type hosts.txt') do ping %%p>>hostresp.txt

where hosts.txt contains either the ip address or host name


Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top