![]() |
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! |
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. |
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? :confused: |
ok, I played with it some, and it worked for me with Win 2k.
Code:
C:\temp>ping 192.168.0.1 >> ping.txt And one clarification: ">" replaces the text in a file ">>" appends the text hope this helps. |
Yep! Thanks! Not sure what I was doing wrong, or why I forgot how to batch program, but that fixed it.
Cheers! |
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:
|
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... :)
|
All times are GMT -8. The time now is 09:40 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project