Fixed Output leading blanks in a string that is "SafeEcho"'s...

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
First an apology if one is needed. In the back of my mind I have a dim memory that this "problem" has already been discussed and fixed and/or worked around, but if that is the case I haven't been able to "dig it up" as of this moment. And the problem is really quite simple: %@SafeEcho is "eating" leading whitespace (at least blanks) on the string that it is echoing. Specifically to demonstrate, a batch file containing just this:
@SafeEcho         This is a test
@SafeEcho #       This is a test
This is a test
#       This is a test
all of the leading blanks being "eaten" by the SafeEcho command.

Well, I really do want those leading blanks, and I'd rather not have the leading pound sign in the output, but, frankly, that's a better option in terms of my goals in writing this batch file than is the leading blanks just "disappearing" altogether. So is there some already-known way to do what I am trying to do?
Thank you, Charles, you've made me very happy!!!:) And since I was relatively sure that this "issue" had been "handled" in the past, I was beginning to think that I was starting to remember things that had not happened (really scary) as well as forgetting things that had!!! Thank you yet again!!!!

- Dan

Charles Dye

Super Moderator
Staff member
May 20, 2008
Albuquerque, NM
In this case, it's my memory at fault, not yours. I think what happened is that I was reviewing the code at some point, forgot why I had made that change, asked myself "What if the user types two spaces before a /? instead of just one?" and put it back the way it was originally.