RyanVM Posted April 30, 2004 Posted April 30, 2004 I've noticed while working on a batch file which writes to a text file with the echo command that commas in a line seem to throw a wrench in the process (ends up writing an empty line). The weird thing is that if you run the same command without writing to a file, commas don't bother the echo command at all. Is there some kind of flag that needs to go in front of the comma so it will be written to a file?
XtremeMaC Posted April 30, 2004 Posted April 30, 2004 could u give an example?i really couldn't understandmaybe u have echo. which makes an empty line..
ZoSTeR Posted April 30, 2004 Posted April 30, 2004 Hmm works fine here:Test1.batecho bla1,bla1 >c:\testout.txtTest2.batecho bla2,bla2 >>c:\testout.txtresults intestout.txtbla1,bla1bla2,bla2
Aaron Posted April 30, 2004 Posted April 30, 2004 Had no problems trying to do what you did. To test this, I typed from command prompt the following:ECHO Testing, to, see, if, this, works >c:\log.txtAnd the output in log.txt came out as:Testing, to, see, if, this, works
RyanVM Posted April 30, 2004 Author Posted April 30, 2004 If I do:echo hi>>blah.txtecho 3waregsm.sys = 1,,,,,,4_,4,1,,,1,4>>blah.txtecho hi>>blah.txtAll you end up with is a blah.txt that looks like:hihiI've narrowed it down to the commas causing the problems.
RyanVM Posted April 30, 2004 Author Posted April 30, 2004 Also note that if we do a batch like this, the same problem occurs:echo hi>>blah.txtecho 3ware78k = 3wdrv100.sys,4>>blah.txtecho hi>>blah.txtHowever, if the comma is removed from line 2, it works fine.
ZoSTeR Posted April 30, 2004 Posted April 30, 2004 You need a space before the >>There is something strange with numbers before a redirect. Somewhere i've read something
Aaron Posted April 30, 2004 Posted April 30, 2004 Keep the >> one spacing away from the text, such as hi and 1,4lol, zoster beats me 2 times in a row
RyanVM Posted April 30, 2004 Author Posted April 30, 2004 Worked like a charm. Most interesting . I wonder why the second example worked without the comma, though (there was still a number before the redirect).EDIT: And having a space at the end of each line shouldn't make a difference in either dosnet.inf or txtsetup.sif, right?
RyanVM Posted April 30, 2004 Author Posted April 30, 2004 Basically, I've got a batch file which patches txtsetup.sif and dosnet.inf to add support for extra RAID controllers. Right now, I'm adding the entries by having the batch file pull values from a separate text file and I want to put those values in the batch file instead to effectively remove the middle man. I'm pretty sure spaces at the end of the line don't matter in txtsetup.sif (since there's a crap ton of lines with spaces at the end by default), but I'm not sure about dosnet.inf.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now