PDA

View Full Version : Adding results of Dos commands to a file


G Mills
10-14-2004, 10:41 AM
Does anyone know how you may be able to store the results of a ping command in a text file?

I have been able to run the ping using the followin code:

Gateway = Dialog.Input("Enter Default Gateway", "What is the Address of your default gateway:", "", MB_ICONQUESTION);
Shell.Execute("ping", "open", Gateway, "", SW_SHOWNORMAL);

My problem is being able to add the ping results to a text file. Any clues?

Jason Pate
10-14-2004, 10:55 AM
Ping 192.168.1.15>ping.txt you can also specify the path to the ping.txt file. The > will redirect the out put for you, this is an OLD dos method but works in XP.


ping x.x.x.x>text file name


Shell.Execute("ping", "open", Gateway..">ping.txt", "", SW_SHOWNORMAL);

I did not run it but that should work.

djpyne
03-20-2006, 10:07 AM
I actual was able to make this work with this:

Shell.Execute("CMD", "open", "/C Ping "..Gateway..">ping.txt", "", SW_SHOWNORMAL);

Adam
03-22-2006, 10:16 AM
This is very interesting to know. Thanks

Adam Kapilik

Worm
03-22-2006, 10:55 AM
To append to the file, use >>

TJS
03-22-2006, 11:02 AM
No kidding! I swear some of these tips are worth tatooing on my arm!


_ _
I / V \ \ \
I | | \ \
I \ / / /
I \ / / /

Adam
03-22-2006, 11:03 AM
The ASCII is strong in this one..

Worm
03-22-2006, 11:05 AM
Here's a post on Pinging from AMS too. I wrote a DLL that does it, and Corey took aother angle

http://www.indigorose.com/forums/showthread.php?t=6216&highlight=ping+dll

Intrigued
03-22-2006, 05:27 PM
How can you all talk about Ping when Pong has so much potential as well?!

(snort laught)
:p

TJS
03-22-2006, 05:37 PM
...I almost named my dog traceroute... :rolleyes