Scan Text Files for Control Characters

Posted On Tue, 16 Apr 2013

Filed under Batch
Tags: , , ,

Comments Dropped leave a response

A large part of programming in Batch is taken up with processing text files. By “text file”, I mean a plain text file with Windows line endings. And “plain text” means no nasty control characters such as Control-Z or the infamous Null Character.

For example, the former is used by copy /a and type as the end-of-file marker, while set and echo interpret the latter as the end of input.

So it’s always a good idea to scan any text files of unknown origin for these troublesome characters before doing anything else. Which is why I wrote the ctrlscan.cmd program described below…

continue reading »