Windows XP Pro
This shows output in the console:
dir | find " free"
This doesn't:
tasklist | find "Image Name"
This does:
tasklist | find /C "Image Name"
And this does write the expected line into the file:
tasklist | find "Image Name" > foo.txt
What causes that?
> tasklist | find "Image Name"
Image Name PID Session Name Session# Mem Usage
Can't reproduce here. Your second command line does work as expected and that way no confusion arises when the fourth one writes that line into a file.
Did you perhaps still have the leading space in the string to search from the previous line when you searched for " free"
?