Perhaps it saves it as "foo.bat.txt" and you dont see the .txt ...

Go to Tools->Folder Options...
Then View and then uncheck the Hide extensions for known file types.

Then just rename it to foo.bat and it should be a batch-file.