Ping every IP address in a text file?
Let´s say I have here a text file with some computer names (each line == 1 name):
computerA
computerB
computerC
...
Is it possible to create a batch file that is pinging all of these computers? And actually a ping is a big output. I don't need the time
or other information; I just would like to know reachable or not. Any ideas?
It´s working now! The problem was like fox said, that I named my batch file as ping.bat
and ping is also a command so this did not work out. I renamed my batch file and now everything is fine.
windows batch-file command-line
migrated from stackoverflow.com Apr 30 '13 at 12:52
This question came from our site for professional and enthusiast programmers.
add a comment |
Let´s say I have here a text file with some computer names (each line == 1 name):
computerA
computerB
computerC
...
Is it possible to create a batch file that is pinging all of these computers? And actually a ping is a big output. I don't need the time
or other information; I just would like to know reachable or not. Any ideas?
It´s working now! The problem was like fox said, that I named my batch file as ping.bat
and ping is also a command so this did not work out. I renamed my batch file and now everything is fine.
windows batch-file command-line
migrated from stackoverflow.com Apr 30 '13 at 12:52
This question came from our site for professional and enthusiast programmers.
1
Look at thefor
command, especially the file parsing mode.
– Damien_The_Unbeliever
Apr 29 '13 at 10:54
add a comment |
Let´s say I have here a text file with some computer names (each line == 1 name):
computerA
computerB
computerC
...
Is it possible to create a batch file that is pinging all of these computers? And actually a ping is a big output. I don't need the time
or other information; I just would like to know reachable or not. Any ideas?
It´s working now! The problem was like fox said, that I named my batch file as ping.bat
and ping is also a command so this did not work out. I renamed my batch file and now everything is fine.
windows batch-file command-line
Let´s say I have here a text file with some computer names (each line == 1 name):
computerA
computerB
computerC
...
Is it possible to create a batch file that is pinging all of these computers? And actually a ping is a big output. I don't need the time
or other information; I just would like to know reachable or not. Any ideas?
It´s working now! The problem was like fox said, that I named my batch file as ping.bat
and ping is also a command so this did not work out. I renamed my batch file and now everything is fine.
windows batch-file command-line
windows batch-file command-line
edited May 16 '15 at 8:28
Peter Mortensen
8,371166185
8,371166185
asked Apr 29 '13 at 10:51
sabisabisabisabi
148113
148113
migrated from stackoverflow.com Apr 30 '13 at 12:52
This question came from our site for professional and enthusiast programmers.
migrated from stackoverflow.com Apr 30 '13 at 12:52
This question came from our site for professional and enthusiast programmers.
1
Look at thefor
command, especially the file parsing mode.
– Damien_The_Unbeliever
Apr 29 '13 at 10:54
add a comment |
1
Look at thefor
command, especially the file parsing mode.
– Damien_The_Unbeliever
Apr 29 '13 at 10:54
1
1
Look at the
for
command, especially the file parsing mode.– Damien_The_Unbeliever
Apr 29 '13 at 10:54
Look at the
for
command, especially the file parsing mode.– Damien_The_Unbeliever
Apr 29 '13 at 10:54
add a comment |
5 Answers
5
active
oldest
votes
Try this:
@echo off
for /f "delims=" %%a in (computerlist.txt) do ping -n 1 %%a >nul && (echo %%a ok) || (echo %%a failed to respond)
pause
If you have to use a filename or path with spaces or odd characters then Instead of (computerlist.txt)
use ( ' type "c:foldercomputer file.txt" ' )
I see the cmd is popping up very shortly and then it´s gone. Even with pause or sleep at the end I dont see any output.
– sabisabi
Apr 29 '13 at 11:36
Try the edited code above which includes the OK response.
– foxidrive
Apr 29 '13 at 12:39
No change at all, this is weird. I copy exact the same code (ok I change the filename) as you posted there into a textfile -> I save this as a .bat and after that I start the .bat file -> cmd popping up and then it´s gone without any output. I´m using win xp, could this be a problem?
– sabisabi
Apr 29 '13 at 13:36
Your pathfilename probably contains spaces. Instead of (computerlist.txt) use ('type "c:foldercomputer file.txt" ')
– foxidrive
Apr 29 '13 at 13:46
3
That is your mistake. Always remember that when naming a batch file you should avoid using the name of a command. In your case the ping command inside the batch file is executing the ping batch file and not the ping command.
– foxidrive
Apr 30 '13 at 9:12
|
show 4 more comments
@Echo OFF
For /F "Usebackq Delims=" %%# in (
"List.txt"
) do (
Echo+
Echo [+] Pinging: %%#
Ping -n 1 "%%#" 1>nul && (
Echo [OK]) || (
Echo [FAILED])
)
Pause&Exit
Output:
[+] Pinging: www.google.com
[OK]
[+] Pinging: ffff
[FAILED]
When I start my .bat I see the output [+] Pinging: computerA , but then the window is disappearing.
– sabisabi
Apr 29 '13 at 11:38
You'he vopied my script as is without several changes?
– ElektroStudios
Apr 29 '13 at 12:43
Well I changed the name of the file, but that´s it
– sabisabi
Apr 29 '13 at 13:34
@sabisabi: start the batch file "manually" from an existing command prompt you you'll be able to read the error message. Don't "double click" batch files that you have to test.
– a_horse_with_no_name
Apr 29 '13 at 14:10
@a_horse_with_no_name if I start the .bat file via cmd (ping.bat) -> there is no new window and my cmd is closing itself without any message
– sabisabi
Apr 29 '13 at 14:15
|
show 2 more comments
I created a ping tool that uses a config file for setting which ip's to ping and creates up to 12 cmd windows and places them side-by-side on your screen.
Each window has a description in the title, also from the config file.
It autodetects your screen size, but currently only supports 1920x1080 and 1600x900. You can create more resolutions manually though. See credits.txt for info.
HellFires Pingtest v1.0
add a comment |
You can try to use the tool I developed - ccmd - to help with similar tasks, it runs any terminal command against a number of targets, targets can be given in csv text file like:
#this is a comment line
#target, description, command (default - ping)
8.8.8.8
1.1.1.1
#in below command {target} will be replaced with 8.8.4.4
8.8.4.4, google DNS, ping -n 1 -w 500 {target}
192.168.1.0/30, my subnet
bbc.com, this is bbc news site
save above file in name.txt and point the script to it with -s option, by default it will run ping command if no other command given.
Run it with:
ccmd.exe -s name.txt -b 10 -c 30
reveals that output:
https://i.stack.imgur.com/23zxQ.png
script written on python but has ccmd.exe vesion, that can be run on windows directly. By default details command logs output saved in ./LOG/ folder.
Source: https://github.com/apraksim/ccmd
add a comment |
An alternative you may wish to look at is to use PowerShell:
cls;
ForEach ($targetComputer in (Get-Content C:installscomputerlist.txt)) {
if (Test-Connection -ComputerName $targetComputer -Count 1 -Quiet) {
"$targetComputer - Ping OK"
} else {
"$targetComputer - Ping FAIL"
}
}
Replace the contants of C:InstallsComputerList.txt and you're away :)
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f589644%2fping-every-ip-address-in-a-text-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this:
@echo off
for /f "delims=" %%a in (computerlist.txt) do ping -n 1 %%a >nul && (echo %%a ok) || (echo %%a failed to respond)
pause
If you have to use a filename or path with spaces or odd characters then Instead of (computerlist.txt)
use ( ' type "c:foldercomputer file.txt" ' )
I see the cmd is popping up very shortly and then it´s gone. Even with pause or sleep at the end I dont see any output.
– sabisabi
Apr 29 '13 at 11:36
Try the edited code above which includes the OK response.
– foxidrive
Apr 29 '13 at 12:39
No change at all, this is weird. I copy exact the same code (ok I change the filename) as you posted there into a textfile -> I save this as a .bat and after that I start the .bat file -> cmd popping up and then it´s gone without any output. I´m using win xp, could this be a problem?
– sabisabi
Apr 29 '13 at 13:36
Your pathfilename probably contains spaces. Instead of (computerlist.txt) use ('type "c:foldercomputer file.txt" ')
– foxidrive
Apr 29 '13 at 13:46
3
That is your mistake. Always remember that when naming a batch file you should avoid using the name of a command. In your case the ping command inside the batch file is executing the ping batch file and not the ping command.
– foxidrive
Apr 30 '13 at 9:12
|
show 4 more comments
Try this:
@echo off
for /f "delims=" %%a in (computerlist.txt) do ping -n 1 %%a >nul && (echo %%a ok) || (echo %%a failed to respond)
pause
If you have to use a filename or path with spaces or odd characters then Instead of (computerlist.txt)
use ( ' type "c:foldercomputer file.txt" ' )
I see the cmd is popping up very shortly and then it´s gone. Even with pause or sleep at the end I dont see any output.
– sabisabi
Apr 29 '13 at 11:36
Try the edited code above which includes the OK response.
– foxidrive
Apr 29 '13 at 12:39
No change at all, this is weird. I copy exact the same code (ok I change the filename) as you posted there into a textfile -> I save this as a .bat and after that I start the .bat file -> cmd popping up and then it´s gone without any output. I´m using win xp, could this be a problem?
– sabisabi
Apr 29 '13 at 13:36
Your pathfilename probably contains spaces. Instead of (computerlist.txt) use ('type "c:foldercomputer file.txt" ')
– foxidrive
Apr 29 '13 at 13:46
3
That is your mistake. Always remember that when naming a batch file you should avoid using the name of a command. In your case the ping command inside the batch file is executing the ping batch file and not the ping command.
– foxidrive
Apr 30 '13 at 9:12
|
show 4 more comments
Try this:
@echo off
for /f "delims=" %%a in (computerlist.txt) do ping -n 1 %%a >nul && (echo %%a ok) || (echo %%a failed to respond)
pause
If you have to use a filename or path with spaces or odd characters then Instead of (computerlist.txt)
use ( ' type "c:foldercomputer file.txt" ' )
Try this:
@echo off
for /f "delims=" %%a in (computerlist.txt) do ping -n 1 %%a >nul && (echo %%a ok) || (echo %%a failed to respond)
pause
If you have to use a filename or path with spaces or odd characters then Instead of (computerlist.txt)
use ( ' type "c:foldercomputer file.txt" ' )
answered Apr 29 '13 at 10:54
foxidrivefoxidrive
26136
26136
I see the cmd is popping up very shortly and then it´s gone. Even with pause or sleep at the end I dont see any output.
– sabisabi
Apr 29 '13 at 11:36
Try the edited code above which includes the OK response.
– foxidrive
Apr 29 '13 at 12:39
No change at all, this is weird. I copy exact the same code (ok I change the filename) as you posted there into a textfile -> I save this as a .bat and after that I start the .bat file -> cmd popping up and then it´s gone without any output. I´m using win xp, could this be a problem?
– sabisabi
Apr 29 '13 at 13:36
Your pathfilename probably contains spaces. Instead of (computerlist.txt) use ('type "c:foldercomputer file.txt" ')
– foxidrive
Apr 29 '13 at 13:46
3
That is your mistake. Always remember that when naming a batch file you should avoid using the name of a command. In your case the ping command inside the batch file is executing the ping batch file and not the ping command.
– foxidrive
Apr 30 '13 at 9:12
|
show 4 more comments
I see the cmd is popping up very shortly and then it´s gone. Even with pause or sleep at the end I dont see any output.
– sabisabi
Apr 29 '13 at 11:36
Try the edited code above which includes the OK response.
– foxidrive
Apr 29 '13 at 12:39
No change at all, this is weird. I copy exact the same code (ok I change the filename) as you posted there into a textfile -> I save this as a .bat and after that I start the .bat file -> cmd popping up and then it´s gone without any output. I´m using win xp, could this be a problem?
– sabisabi
Apr 29 '13 at 13:36
Your pathfilename probably contains spaces. Instead of (computerlist.txt) use ('type "c:foldercomputer file.txt" ')
– foxidrive
Apr 29 '13 at 13:46
3
That is your mistake. Always remember that when naming a batch file you should avoid using the name of a command. In your case the ping command inside the batch file is executing the ping batch file and not the ping command.
– foxidrive
Apr 30 '13 at 9:12
I see the cmd is popping up very shortly and then it´s gone. Even with pause or sleep at the end I dont see any output.
– sabisabi
Apr 29 '13 at 11:36
I see the cmd is popping up very shortly and then it´s gone. Even with pause or sleep at the end I dont see any output.
– sabisabi
Apr 29 '13 at 11:36
Try the edited code above which includes the OK response.
– foxidrive
Apr 29 '13 at 12:39
Try the edited code above which includes the OK response.
– foxidrive
Apr 29 '13 at 12:39
No change at all, this is weird. I copy exact the same code (ok I change the filename) as you posted there into a textfile -> I save this as a .bat and after that I start the .bat file -> cmd popping up and then it´s gone without any output. I´m using win xp, could this be a problem?
– sabisabi
Apr 29 '13 at 13:36
No change at all, this is weird. I copy exact the same code (ok I change the filename) as you posted there into a textfile -> I save this as a .bat and after that I start the .bat file -> cmd popping up and then it´s gone without any output. I´m using win xp, could this be a problem?
– sabisabi
Apr 29 '13 at 13:36
Your pathfilename probably contains spaces. Instead of (computerlist.txt) use ('type "c:foldercomputer file.txt" ')
– foxidrive
Apr 29 '13 at 13:46
Your pathfilename probably contains spaces. Instead of (computerlist.txt) use ('type "c:foldercomputer file.txt" ')
– foxidrive
Apr 29 '13 at 13:46
3
3
That is your mistake. Always remember that when naming a batch file you should avoid using the name of a command. In your case the ping command inside the batch file is executing the ping batch file and not the ping command.
– foxidrive
Apr 30 '13 at 9:12
That is your mistake. Always remember that when naming a batch file you should avoid using the name of a command. In your case the ping command inside the batch file is executing the ping batch file and not the ping command.
– foxidrive
Apr 30 '13 at 9:12
|
show 4 more comments
@Echo OFF
For /F "Usebackq Delims=" %%# in (
"List.txt"
) do (
Echo+
Echo [+] Pinging: %%#
Ping -n 1 "%%#" 1>nul && (
Echo [OK]) || (
Echo [FAILED])
)
Pause&Exit
Output:
[+] Pinging: www.google.com
[OK]
[+] Pinging: ffff
[FAILED]
When I start my .bat I see the output [+] Pinging: computerA , but then the window is disappearing.
– sabisabi
Apr 29 '13 at 11:38
You'he vopied my script as is without several changes?
– ElektroStudios
Apr 29 '13 at 12:43
Well I changed the name of the file, but that´s it
– sabisabi
Apr 29 '13 at 13:34
@sabisabi: start the batch file "manually" from an existing command prompt you you'll be able to read the error message. Don't "double click" batch files that you have to test.
– a_horse_with_no_name
Apr 29 '13 at 14:10
@a_horse_with_no_name if I start the .bat file via cmd (ping.bat) -> there is no new window and my cmd is closing itself without any message
– sabisabi
Apr 29 '13 at 14:15
|
show 2 more comments
@Echo OFF
For /F "Usebackq Delims=" %%# in (
"List.txt"
) do (
Echo+
Echo [+] Pinging: %%#
Ping -n 1 "%%#" 1>nul && (
Echo [OK]) || (
Echo [FAILED])
)
Pause&Exit
Output:
[+] Pinging: www.google.com
[OK]
[+] Pinging: ffff
[FAILED]
When I start my .bat I see the output [+] Pinging: computerA , but then the window is disappearing.
– sabisabi
Apr 29 '13 at 11:38
You'he vopied my script as is without several changes?
– ElektroStudios
Apr 29 '13 at 12:43
Well I changed the name of the file, but that´s it
– sabisabi
Apr 29 '13 at 13:34
@sabisabi: start the batch file "manually" from an existing command prompt you you'll be able to read the error message. Don't "double click" batch files that you have to test.
– a_horse_with_no_name
Apr 29 '13 at 14:10
@a_horse_with_no_name if I start the .bat file via cmd (ping.bat) -> there is no new window and my cmd is closing itself without any message
– sabisabi
Apr 29 '13 at 14:15
|
show 2 more comments
@Echo OFF
For /F "Usebackq Delims=" %%# in (
"List.txt"
) do (
Echo+
Echo [+] Pinging: %%#
Ping -n 1 "%%#" 1>nul && (
Echo [OK]) || (
Echo [FAILED])
)
Pause&Exit
Output:
[+] Pinging: www.google.com
[OK]
[+] Pinging: ffff
[FAILED]
@Echo OFF
For /F "Usebackq Delims=" %%# in (
"List.txt"
) do (
Echo+
Echo [+] Pinging: %%#
Ping -n 1 "%%#" 1>nul && (
Echo [OK]) || (
Echo [FAILED])
)
Pause&Exit
Output:
[+] Pinging: www.google.com
[OK]
[+] Pinging: ffff
[FAILED]
answered Apr 29 '13 at 11:05
ElektroStudiosElektroStudios
69861444
69861444
When I start my .bat I see the output [+] Pinging: computerA , but then the window is disappearing.
– sabisabi
Apr 29 '13 at 11:38
You'he vopied my script as is without several changes?
– ElektroStudios
Apr 29 '13 at 12:43
Well I changed the name of the file, but that´s it
– sabisabi
Apr 29 '13 at 13:34
@sabisabi: start the batch file "manually" from an existing command prompt you you'll be able to read the error message. Don't "double click" batch files that you have to test.
– a_horse_with_no_name
Apr 29 '13 at 14:10
@a_horse_with_no_name if I start the .bat file via cmd (ping.bat) -> there is no new window and my cmd is closing itself without any message
– sabisabi
Apr 29 '13 at 14:15
|
show 2 more comments
When I start my .bat I see the output [+] Pinging: computerA , but then the window is disappearing.
– sabisabi
Apr 29 '13 at 11:38
You'he vopied my script as is without several changes?
– ElektroStudios
Apr 29 '13 at 12:43
Well I changed the name of the file, but that´s it
– sabisabi
Apr 29 '13 at 13:34
@sabisabi: start the batch file "manually" from an existing command prompt you you'll be able to read the error message. Don't "double click" batch files that you have to test.
– a_horse_with_no_name
Apr 29 '13 at 14:10
@a_horse_with_no_name if I start the .bat file via cmd (ping.bat) -> there is no new window and my cmd is closing itself without any message
– sabisabi
Apr 29 '13 at 14:15
When I start my .bat I see the output [+] Pinging: computerA , but then the window is disappearing.
– sabisabi
Apr 29 '13 at 11:38
When I start my .bat I see the output [+] Pinging: computerA , but then the window is disappearing.
– sabisabi
Apr 29 '13 at 11:38
You'he vopied my script as is without several changes?
– ElektroStudios
Apr 29 '13 at 12:43
You'he vopied my script as is without several changes?
– ElektroStudios
Apr 29 '13 at 12:43
Well I changed the name of the file, but that´s it
– sabisabi
Apr 29 '13 at 13:34
Well I changed the name of the file, but that´s it
– sabisabi
Apr 29 '13 at 13:34
@sabisabi: start the batch file "manually" from an existing command prompt you you'll be able to read the error message. Don't "double click" batch files that you have to test.
– a_horse_with_no_name
Apr 29 '13 at 14:10
@sabisabi: start the batch file "manually" from an existing command prompt you you'll be able to read the error message. Don't "double click" batch files that you have to test.
– a_horse_with_no_name
Apr 29 '13 at 14:10
@a_horse_with_no_name if I start the .bat file via cmd (ping.bat) -> there is no new window and my cmd is closing itself without any message
– sabisabi
Apr 29 '13 at 14:15
@a_horse_with_no_name if I start the .bat file via cmd (ping.bat) -> there is no new window and my cmd is closing itself without any message
– sabisabi
Apr 29 '13 at 14:15
|
show 2 more comments
I created a ping tool that uses a config file for setting which ip's to ping and creates up to 12 cmd windows and places them side-by-side on your screen.
Each window has a description in the title, also from the config file.
It autodetects your screen size, but currently only supports 1920x1080 and 1600x900. You can create more resolutions manually though. See credits.txt for info.
HellFires Pingtest v1.0
add a comment |
I created a ping tool that uses a config file for setting which ip's to ping and creates up to 12 cmd windows and places them side-by-side on your screen.
Each window has a description in the title, also from the config file.
It autodetects your screen size, but currently only supports 1920x1080 and 1600x900. You can create more resolutions manually though. See credits.txt for info.
HellFires Pingtest v1.0
add a comment |
I created a ping tool that uses a config file for setting which ip's to ping and creates up to 12 cmd windows and places them side-by-side on your screen.
Each window has a description in the title, also from the config file.
It autodetects your screen size, but currently only supports 1920x1080 and 1600x900. You can create more resolutions manually though. See credits.txt for info.
HellFires Pingtest v1.0
I created a ping tool that uses a config file for setting which ip's to ping and creates up to 12 cmd windows and places them side-by-side on your screen.
Each window has a description in the title, also from the config file.
It autodetects your screen size, but currently only supports 1920x1080 and 1600x900. You can create more resolutions manually though. See credits.txt for info.
HellFires Pingtest v1.0
answered Apr 20 '16 at 10:27
Lord HellFireLord HellFire
91
91
add a comment |
add a comment |
You can try to use the tool I developed - ccmd - to help with similar tasks, it runs any terminal command against a number of targets, targets can be given in csv text file like:
#this is a comment line
#target, description, command (default - ping)
8.8.8.8
1.1.1.1
#in below command {target} will be replaced with 8.8.4.4
8.8.4.4, google DNS, ping -n 1 -w 500 {target}
192.168.1.0/30, my subnet
bbc.com, this is bbc news site
save above file in name.txt and point the script to it with -s option, by default it will run ping command if no other command given.
Run it with:
ccmd.exe -s name.txt -b 10 -c 30
reveals that output:
https://i.stack.imgur.com/23zxQ.png
script written on python but has ccmd.exe vesion, that can be run on windows directly. By default details command logs output saved in ./LOG/ folder.
Source: https://github.com/apraksim/ccmd
add a comment |
You can try to use the tool I developed - ccmd - to help with similar tasks, it runs any terminal command against a number of targets, targets can be given in csv text file like:
#this is a comment line
#target, description, command (default - ping)
8.8.8.8
1.1.1.1
#in below command {target} will be replaced with 8.8.4.4
8.8.4.4, google DNS, ping -n 1 -w 500 {target}
192.168.1.0/30, my subnet
bbc.com, this is bbc news site
save above file in name.txt and point the script to it with -s option, by default it will run ping command if no other command given.
Run it with:
ccmd.exe -s name.txt -b 10 -c 30
reveals that output:
https://i.stack.imgur.com/23zxQ.png
script written on python but has ccmd.exe vesion, that can be run on windows directly. By default details command logs output saved in ./LOG/ folder.
Source: https://github.com/apraksim/ccmd
add a comment |
You can try to use the tool I developed - ccmd - to help with similar tasks, it runs any terminal command against a number of targets, targets can be given in csv text file like:
#this is a comment line
#target, description, command (default - ping)
8.8.8.8
1.1.1.1
#in below command {target} will be replaced with 8.8.4.4
8.8.4.4, google DNS, ping -n 1 -w 500 {target}
192.168.1.0/30, my subnet
bbc.com, this is bbc news site
save above file in name.txt and point the script to it with -s option, by default it will run ping command if no other command given.
Run it with:
ccmd.exe -s name.txt -b 10 -c 30
reveals that output:
https://i.stack.imgur.com/23zxQ.png
script written on python but has ccmd.exe vesion, that can be run on windows directly. By default details command logs output saved in ./LOG/ folder.
Source: https://github.com/apraksim/ccmd
You can try to use the tool I developed - ccmd - to help with similar tasks, it runs any terminal command against a number of targets, targets can be given in csv text file like:
#this is a comment line
#target, description, command (default - ping)
8.8.8.8
1.1.1.1
#in below command {target} will be replaced with 8.8.4.4
8.8.4.4, google DNS, ping -n 1 -w 500 {target}
192.168.1.0/30, my subnet
bbc.com, this is bbc news site
save above file in name.txt and point the script to it with -s option, by default it will run ping command if no other command given.
Run it with:
ccmd.exe -s name.txt -b 10 -c 30
reveals that output:
https://i.stack.imgur.com/23zxQ.png
script written on python but has ccmd.exe vesion, that can be run on windows directly. By default details command logs output saved in ./LOG/ folder.
Source: https://github.com/apraksim/ccmd
answered Jan 25 at 10:44
apraksimapraksim
1
1
add a comment |
add a comment |
An alternative you may wish to look at is to use PowerShell:
cls;
ForEach ($targetComputer in (Get-Content C:installscomputerlist.txt)) {
if (Test-Connection -ComputerName $targetComputer -Count 1 -Quiet) {
"$targetComputer - Ping OK"
} else {
"$targetComputer - Ping FAIL"
}
}
Replace the contants of C:InstallsComputerList.txt and you're away :)
add a comment |
An alternative you may wish to look at is to use PowerShell:
cls;
ForEach ($targetComputer in (Get-Content C:installscomputerlist.txt)) {
if (Test-Connection -ComputerName $targetComputer -Count 1 -Quiet) {
"$targetComputer - Ping OK"
} else {
"$targetComputer - Ping FAIL"
}
}
Replace the contants of C:InstallsComputerList.txt and you're away :)
add a comment |
An alternative you may wish to look at is to use PowerShell:
cls;
ForEach ($targetComputer in (Get-Content C:installscomputerlist.txt)) {
if (Test-Connection -ComputerName $targetComputer -Count 1 -Quiet) {
"$targetComputer - Ping OK"
} else {
"$targetComputer - Ping FAIL"
}
}
Replace the contants of C:InstallsComputerList.txt and you're away :)
An alternative you may wish to look at is to use PowerShell:
cls;
ForEach ($targetComputer in (Get-Content C:installscomputerlist.txt)) {
if (Test-Connection -ComputerName $targetComputer -Count 1 -Quiet) {
"$targetComputer - Ping OK"
} else {
"$targetComputer - Ping FAIL"
}
}
Replace the contants of C:InstallsComputerList.txt and you're away :)
answered Jan 25 at 10:52
Fazer87Fazer87
10.4k12640
10.4k12640
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f589644%2fping-every-ip-address-in-a-text-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Look at the
for
command, especially the file parsing mode.– Damien_The_Unbeliever
Apr 29 '13 at 10:54