Command works on CMD line but not in batch?

Hi All,

This command works when I type it on but when I run the batch file it doesn't..any ideas why?

attrib.exe * | find /c /v "" >filecount.txt

It works on my Windows XP PC.
I did notice that cmd changed the line slightly before execution:

attrib.exe * | find /c /v "" 1>filecount.txt

Also, you get the same result from:

dir /b | find /c /v "" 1>filecount.txt

When you say that yours does not work, what Windows do you have and what happens.