I really appreciate the responses from all three of you, especially given I didn't provide much info.
It sounds plausible to me what you are suggesting and I will try and test it out when I have chance.
I have managed to bodge my way round it a bit by another very crude (I have much to learn!) script that reads all the files (using type command) and then outputs to a .new version. When I run the .new version with my original script it works fine.
I do hope to get to the bottom of this in a more intelligent fashion, so I will try out the suggestions.
OS: Win XP