02-07-2004, 07:21 PM | #1 (permalink) |
Bringer of good Moos...
Location: Midlands, UK
|
basic/easy question about batch files
Ok, I know it's 3AM, but even so, it's only a damn batch file - but it doesn't work!
What am I doing wrong? blah ping www.google.co.uk>d:\temp\pinging.log blah The file pinging.log is getting created, but there is nothing in it! I'm using Win 2K. FYI I'm trying to ping google and my website etc on a fairly frequent basis to keep a log of how good my connection is. Google is just a good site to have a a check that it's my connection, not my website that has gone down, or vice versa. Cheers all - I know it'll be something stupid, but I thought I'd ask!
__________________
Moo! I'm mooey! Last edited by cowudders14; 02-07-2004 at 07:28 PM.. |
02-07-2004, 09:39 PM | #2 (permalink) | |
Crazy
Location: Ahh, the lovely South
|
Quote:
i.e. ping www.domainname.com >> yourfile.txt Give it a try. If it doesn't work, I'll see if I have any old batch files lying around.
__________________
mmmm.... pudding |
|
02-08-2004, 10:07 AM | #3 (permalink) |
Bringer of good Moos...
Location: Midlands, UK
|
Still not working.
Here's the whole batch file. As you can see, I have tried variations on the theme, but none seem to work. date/t>>d:\temp\pinging.log time/t>d:\temp\pinging.log ping www.broadcaster.org.uk >>d:\temp\pinging.log ping www.daftmoo.co.uk >d:\temp\pinging.log ping www.google.co.uk>d:\temp\pinging.log echo line 1 >d:\temp\pinging.log echo line 2 >d:\temp\pinging.log Here's the creen output: D:\Mytemp>date/t1>>d:\temp\pinging.log D:\Mytemp>time/t1>d:\temp\pinging.log D:\Mytemp>ping www.broadcaster.org.uk 1>>d:\temp\pinging.log D:\Mytemp>ping www.daftmoo.co.uk 1>d:\temp\pinging.log D:\Mytemp>ping www.google.co.uk 1>d:\temp\pinging.log D:\Mytemp>echo line 1 1>d:\temp\pinging.log D:\Mytemp>echo line 2 1>d:\temp\pinging.log The time taken for the screen to go through the lines shows that the ping command is running, but I just can't seem to capture the output. The file created has "line 2" inside it, followed by a blank line, but nothing else. I'm very confused. Help?
__________________
Moo! I'm mooey! |
02-09-2004, 09:52 AM | #4 (permalink) |
Crazy
Location: Ahh, the lovely South
|
ok, I played with it some, and it worked for me with Win 2k.
Code:
C:\temp>ping 192.168.0.1 >> ping.txt C:\temp>type ping.txt Pinging 192.168.0.1 with 32 bytes of data: Reply from 192.168.0.1: bytes=32 time<10ms TTL=64 Reply from 192.168.0.1: bytes=32 time<10ms TTL=64 Reply from 192.168.0.1: bytes=32 time<10ms TTL=64 Reply from 192.168.0.1: bytes=32 time<10ms TTL=64 Ping statistics for 192.168.0.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms And one clarification: ">" replaces the text in a file ">>" appends the text hope this helps.
__________________
mmmm.... pudding Last edited by digby; 02-09-2004 at 09:57 AM.. |
02-10-2004, 10:41 PM | #6 (permalink) | ||||
Devils Cabana Boy
Location: Central Coast CA
|
as for > vs >>
> rewrites the file to the4 enterd text, where as >> adds the text onto the end of the file so Quote:
Quote:
Quote:
Quote:
__________________
Donate Blood! "Love is not finding the perfect person, but learning to see an imperfect person perfectly." -Sam Keen |
||||
02-14-2004, 09:58 AM | #7 (permalink) |
Bringer of good Moos...
Location: Midlands, UK
|
Thanks - I realised the main problem I had beofre was along those lines - it was working, but I wasn't appending. Thus, it was outputting to the file, but as I was leaving a few blank lines at the end (intending to run the file on a regular basis via task scheduler), it was writing the file correctly, the overwriting it with the blank lines. Duh...
__________________
Moo! I'm mooey! |
Tags |
basic or easy, batch, files, question |
|
|