Without an OS, it's hard to tell what you have available in the way of tools. If this is XP you can write a logic loop inside a for /f construct. If this is any version of Windows, you could use vbscript as described
here
. Either way it's the brute force method and neither solution will be the high point of your coding career.

Happy Computing. 8-)
PS. You cannot open a file both input/ouput using the
FOR (batch) loop or the
FileSystemObject (vbscript).