But why do you need us to tell you that. All you need to do is prepare a file with traditionally "problem" characters, and see how the various solutions handle it.
I suppose I am just looking to experienced users to advise me of any known limitations/issues I may encounter.
DOS batch character handling has eaten a bunch of my time over the years. I've run tests and such but eventually I will run into a situation that fails
I wish there were a set concise of "RULES" which detailed batch character handling. Things like:
-What characters can be safely passed as parameters to other batch labels
-What characters can be safely passed as parameters to other batch files
- How character handling differs within variables and without variables - ex:
Code: Select all
(ECHO mytext>RandomTextFile)>newTextFile
vs
Code: Select all
SET "myvar=mytext>RandomTextFile"
ECHO %myvar%>newTextFile
- and these are just a few.
My day job is not as a coder and I do these things for personal / friends / family. It can be months between my small scripting sessions because of time constraints and each time I need to dig up some references on how to do stuff because I don't use it every day.
This forum is a tremendous source and the people have been very generous with their time and assistance, but I don't always want to bother others in order to find a solution - and searching/reading through post after post to find an answer is very time consuming.
An example is my current task of generating a few SQL scripts from with batch files. I want the code to be as simple as possible, readable, and maintainable. I really don't like having to escape every parentheses "^( ... ^)" if I can avoid it, because when I change the SQL script, I will probably miss one of these instances and waste time trying to figure out why the whole process failed. I did my searches and read through several solutions here on dostips as well as SO. I found your printhere.bat, as well as a couple of "heredoc" solutions - none of them worked out of the box for me - but they are working now. you guys provided me with some solutiuons using jrepl & findrepl and so I have several viable solutions and just looking for advice on the best one for my tasks.
Please don't take my questions for advice as an offloading of due dilligence. I've learned over the years that there is great knowledge & wisdom in groups and so I ask for advice much more now than when I was younger and "wiser" - in my own eyes.
As it stands right now, I'm preferring the jrepl solution since I don't have to do anything special with %variable% names or exclamation point escaping "^!" - I am very appreciative for you help in providing both the "jrepl.bat" as well as the syntax for my needs - thank you.