i want to design a program that can be used on any machine to ping their gateway.
basically, what i was thinking i could do is create a batch file that first ran ipconfig. then it would run the ping command. to get the gateway, i was thinking using some sort of a command that could use information in another designated line.
(default gateway..........

ping (line 2 characters 27-37)
I was thinking along the lines of using something like the goto or call commands, but i don't know how to use them, or if it is even possible to extract characters from a previous command line. Any suggestions on how i can make this .bat would be greatly appreciated!

Recommended Answers

All 14 Replies

why does no one even look at my post?

Ahh batch files.

Ok well.. you only have one question to ask yourself... when you can just click

Start --> run --> cmd --> ipconfig /all --> ping (default gateway address)

why would you want to make is a batch file.. or program... ?

Why do you want to ping your default gateway?

because this isnt necessarily for me.

i fix comptuers. i am net + certified. i am checking internet connections on a daily basis. if i could just double click on an icon that would run a gateway ping, it could save me oodles of time (i cant belive i just said oodles.) (again.).

also, there are people who are so incompident that they refuse to learn how to use a simple command like pinging the gateway. if their internet is malfunctioning, i will tell them to run the file i left on their computer. ill have them read back to me what they see. then i dont have to deal with this:
"ok type in ping, space, then the gateway number you just read to me"
"ok ......... It said it didnt couldnt find the host"
"are you sure you didnt type in your IP address and not your gateway?"
"hold on................ im gonna try to put a magnet to the harddrive maybe that will fix it"
"no dont do that!!"
(of course their on their merry little way to their refrigerator by now, getting a magnet, and demagging their hard drive. I end up getting charged for it because i didn't "explain things good enough." This is a TRUE story)

LoL.. ok.. would pinging the localhost help you out any... my networking is rough..

But wouldn't that complete what you needed to know?

no. i need to ping the gateway to troubleshoot to see if the problem is between the modem/router and the computer. Pinging the gateway sends 4 packets to the modem/router (the gateway) and those packets are bounced back. if the computer recieves the packets, i know the problem is between the modem/router and the wall+the rest of the internet.
for instance, a bad ethernet cable going from modem to motherboard.

Ok soo.. Are you working on the same network which would enable all of the batch files to be needing the same default gateway address?

no i need this thing to be able to figure out the default gateway depending on whatever machine its on. like being able to auto-detect it and input it as a switch after the ping command line

Ok.. Give me a few seconds

I'll see what I can do

lightning do you have MSN or AIM? that would be easier than this.

does it have to be a bacth program??
I know of VB code that can retrieve the uses gateway, ip and subnet mask. Then you can ping it...what do you think??

hmmm... is it user friendly? like can it be set up so that they can click the icon or w/e and it will run through in the background and tell them the results like how many packets have been lost and shit?

I still have what we came up with laying around. Hmm... How's it working for you?

Sorry I did't get back to you.... it is Window based and user friendly Still interested? Do you code in VB??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.