Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This should be pretty simple but for some reason, my situation is proving to be a bit tricky...

I want to save the results of a ping to a text file. To do so, I am using the following command in a .bat:

ping X.X.X.X >> ping.txt

When I run this .bat file, the file created (ping.txt) contains hundreds of rows of the input rather than the output:

C:\Documents and Settings\XYZ\Desktop>ping X.X.X.X  1>>ping.txt 

C:\Documents and Settings\XYZ\Desktop>ping X.X.X.X  1>>ping.txt 

C:\Documents and Settings\XYZ\Desktop>ping X.X.X.X  1>>ping.txt 

Anyone have any idea why I'm not getting the results of ping to the text file?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Is your bat file called ping.bat? try renaming it to pong.bat and then run pong.bat!

share|improve this answer
    
wow... just wow - what happened there - the file was named ping.bat; why would this cause a problem? I'm assuming it's because ping.bat/ping.exe causes a conflict? –  emtunc Nov 19 '10 at 10:47
1  
When you type foo at a command prompt, your windows shell (cmd.exe or whatever) looks in each of the directories in %PATH% for a file named foo with any of the filename extensions associated with executable files (.bat .cmd .exe ...) It runs the first it finds. Now consider recursion. –  RedGrittyBrick Nov 19 '10 at 10:54
    
LOL i thought you were trolling until i read the comment above ^ –  XAleXOwnZX Sep 21 '12 at 5:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.