# Windows batch file executes some commands that return output over and over

I tried to put commands that return output into batch file. When I run the batch file it executes the command over and over until I cancel with CTRL+C.

I observed this behavior in Windows CE, Windows XP, Windows 7 and Server 2003. At first I thought I made a mistake with LDIFDE but the same thing goes for PING.

Is there something I missed with batch scripting?

The file contains one line:

``````ping google.com
``````

• Without knowing the contents of the batch script, this question is going to be impossible to answer :-) – Chris J Sep 2 '11 at 14:53
• Surely I isolated it to one command only. – Dean Sep 2 '11 at 14:58
• I am sorry I left this detail, It seems obvious - I placed only one command in the batch file to isolate the issue. – Dean Sep 2 '11 at 15:03
• That's odd, how are you executing the batch script? Without some sort of looping control structure it shouldn't be doing this ... – Zypher Sep 2 '11 at 15:12
• I've seen this before a long time ago, but I can't recall what it was. I think it had something to do with it not seeing ping as a command. I also see your runnign this from `D:\Desktop`. Post your batch file so we can help. – Nixphoe Sep 2 '11 at 15:28

I.think you named your script `ping.bat` or `ping.cmd` and it is calling itself.
• Simply include the file extension in your script so it is `ping.exe google.com`
• Use the full path to ping `%SystemRoot%\system32\ping.exe`