Trim Leading and Trailing Whitespace from a String

Posted On Mon, 30 Sep 2013

Filed under Batch
Tags: , , , , , ,

Comments Dropped leave a response

Hello All! 🙂

I’m back after a long hiatus with a Batch file that trims leading and trailing whitespace from a string. The program won’t choke on “poison characters” and doesn’t care about the state of delayed expansion. At last, something other people may find useful! 😉

To achieve this, however, I’ve had to employ several advanced Batch programming techniques. The code may be difficult for beginners to follow, but I’ve tried to explain how the program works and I’ve included links to fuller explanations of some of the techniques used.

continue reading »