Scripts
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb Site ManagementScripts

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 5th, 2007, 10:43 AM
Dante68 Dante68 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 3 Dante68 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 28 sec
Reputation Power: 0
Unhappy Anybody know how to do a ping sweep in DOS and save the output?

I am a relative newbie at this and need assistance. I know that you can do a for loop in DOS by doing the following:
for /f %%i in (a text file with machine names) do ping >c:\results.txt

When I run this it seems to iterate through the file and prints the command to the .txt file. It doesn't print what machines responded... HELP!!!

Reply With Quote
  #2  
Old January 5th, 2007, 04:10 PM
Dante68 Dante68 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 3 Dante68 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 28 sec
Reputation Power: 0
Guess not...

Quote:
Originally Posted by Dante68
I am a relative newbie at this and need assistance. I know that you can do a for loop in DOS by doing the following:
for /f %%i in (a text file with machine names) do ping >c:\results.txt

When I run this it seems to iterate through the file and prints the command to the .txt file. It doesn't print what machines responded... HELP!!!

Reply With Quote
  #3  
Old January 8th, 2007, 02:23 PM
Dante68 Dante68 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2007
Posts: 3 Dante68 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 28 sec
Reputation Power: 0
came up with the script

Quote:
Originally Posted by Dante68
Guess not...


@echo off

type nul>pass.txt

type nul>fail.txt

for /f %%a in (machines.txt) do call :ping %%a

goto :EOF

:ping

echo testing %1

ping %1|find /i "TTL=">nul

if %errorlevel%==0 echo pass&echo %1>>pass.txt

if %errorlevel%==1 echo FAIL&echo %1>>fail.txt

Reply With Quote
  #4  
Old January 9th, 2007, 10:55 PM
Nilpo's Avatar
Nilpo Nilpo is offline
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2004
Location: New Springfield, OH
Posts: 863 Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)Nilpo User rank is General 3rd Grade (Above 100000 Reputation Level)  Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2Folding Points: 600856 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 5 Days 16 h 50 m 17 sec
Reputation Power: 1185
Send a message via ICQ to Nilpo Send a message via AIM to Nilpo Send a message via MSN to Nilpo Send a message via Yahoo to Nilpo Send a message via Google Talk to Nilpo Send a message via Skype to Nilpo Send a message via XFire to Nilpo
Facebook MySpace Orkut
This a better job for WSH, but if it works great.
__________________
Don't like me? Click it.

Scripting problems? Windows questions? Ask the Windows Guru!

Stay up to date with all of my latest content. Follow me on Twitter!

Help us help you! Post your exact error message with these easy tips!

Reply With Quote
  #5  
Old February 15th, 2007, 03:12 AM
Purple Avenger Purple Avenger is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2006
Posts: 271 Purple Avenger User rank is Sergeant (500 - 2000 Reputation Level)Purple Avenger User rank is Sergeant (500 - 2000 Reputation Level)Purple Avenger User rank is Sergeant (500 - 2000 Reputation Level)Purple Avenger User rank is Sergeant (500 - 2000 Reputation Level)Purple Avenger User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 2 Days 1 h 51 m 31 sec
Reputation Power: 14
Try ping -a whatever

On Windows that'll report the machine name as part of the ping output.

Reply With Quote
  #6  
Old March 13th, 2010, 02:45 AM
Funk_Green Funk_Green is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2010
Posts: 1 Funk_Green User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 45 sec
Reputation Power: 0
type the following in CMD window:

for /L %z in (1,1,254) do @ping 10.200.0.%z -w 10 -n 1

explanation as follows:

(1,1,254) = starting point (last value in IP address represented by '%z'), ping increment (if you set to 10, then it will ping .10, .20, .30, etc), and 254 is ending point

the '-n1' at the end is how many times to ping an IP

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb Site ManagementScripts > Anybody know how to do a ping sweep in DOS and save the output?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap