Jump to content

Recommended Posts

Posted

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?


Posted

Hmm works fine here:

Test1.bat

echo bla1,bla1 >c:\testout.txt

Test2.bat

echo bla2,bla2 >>c:\testout.txt

results in

testout.txt

bla1,bla1bla2,bla2
Posted

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.txt

And the output in log.txt came out as:

Testing, to, see, if, this, works

Posted

If I do:

echo hi>>blah.txtecho 3waregsm.sys = 1,,,,,,4_,4,1,,,1,4>>blah.txtecho hi>>blah.txt

All you end up with is a blah.txt that looks like:

hihi

I've narrowed it down to the commas causing the problems.

Posted

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.txt

However, if the comma is removed from line 2, it works fine.

Posted

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? :rolleyes:

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...