Computing.Net > Forums > Programming > Batch to Ping Help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch to Ping Help

Reply to Message Icon

Name: sype
Date: October 15, 2007 at 10:08:33 Pacific
OS: XP PRo
CPU/Ram: Dual core
Product: Me
Comment:

Ok so i have this batch file to ping a list of ip's

This is what i have:
@echo off
cd C:\Documents and Settings\username\My Documents\Ping printers
ping -n 1 172.16.1.223 >> pinginfo1.txt
ping -n 1 172.16.1.220 >> pinginfo2.txt
ping -n 1 172.16.1.214 >> pinginfo3.txt
ping -n 1 172.16.1.218 >> pinginfo4.txt
ping -n 1 172.16.1.215 >> pinginfo5.txt
ping -n 1 172.16.1.221 >> pinginfo6.txt
ping -n 1 172.16.1.222 >> pinginfo7.txt
ping -n 1 172.16.1.224 >> pinginfo8.txt
ping -n 1 172.16.1.219 >> pinginfo9.txt
ping -n 1 172.16.1.216 >> pinginfo10.txt
ping -n 1 172.16.1.217 >> pinginfo11.txt

I get the error:
The filename, directory name, or volume label syntax is incorrect.


I am not a scripter or a programmer, i am new to this, so if you see anything wrong or have any suggestions to my batch file, i would be very happy.

Thanks,
Sype



Sponsored Link
Ads by Google

Response Number 1
Name: tonysathre
Date: October 15, 2007 at 14:05:51 Pacific
Reply:

@echo off
cd "C:\Documents and Settings\%username%\My Documents\Ping printers"
ping -n 1 172.16.1.223 >> pinginfo1.txt
ping -n 1 172.16.1.220 >> pinginfo2.txt
ping -n 1 172.16.1.214 >> pinginfo3.txt
ping -n 1 172.16.1.218 >> pinginfo4.txt
ping -n 1 172.16.1.215 >> pinginfo5.txt
ping -n 1 172.16.1.221 >> pinginfo6.txt
ping -n 1 172.16.1.222 >> pinginfo7.txt
ping -n 1 172.16.1.224 >> pinginfo8.txt
ping -n 1 172.16.1.219 >> pinginfo9.txt
ping -n 1 172.16.1.216 >> pinginfo10.txt
ping -n 1 172.16.1.217 >> pinginfo11.txt

"Computer security." — Oxymoron


0

Response Number 2
Name: sype
Date: October 17, 2007 at 06:27:53 Pacific
Reply:

Thanks, i figured out what the problem was. I had two batch files in one folder, and they were named "ping" and "ping2" I removed the ping batch and the ping2 worked. I did not know you could have more than two "batch" files in one folder.


0

Response Number 3
Name: tonysathre
Date: October 17, 2007 at 10:00:42 Pacific
Reply:

There just normal files as any other file. It is not a good idea to name your batch files the same as internal or external commands.

"Computer security." — Oxymoron


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch to Ping Help

Batch to Ping www.computing.net/answers/programming/batch-to-ping/17265.html

Batch to show error message if PING fails? www.computing.net/answers/programming/batch-to-show-error-message-if-ping-fails/19086.html

Simple Batch File command help www.computing.net/answers/programming/simple-batch-file-command-help/16568.html