batch: how to echo number to a file

  • Thread starter Thread starter John Doe
  • Start date Start date
J

John Doe

Hi,

I came across such interesting problem.

This doesn't work as expexted, settngs.ini holds only first line, second line is *not* echoed there:
echo # whatever>settings.ini
echo --max-time 2>>settings.ini

This works fine, but there is redundant " " after 2 in settings ini:
echo # whatever>settings.ini
echo --max-time 2 >>settings.ini

So it looks like echo cannot write to files, when the line is ending with number :-( In windows 98, there
wasn't such a problem (AFAIK).

Could you give me any advice how I can output line ending with a number to a file, but witout redundant
" " after the number? Thank you.

With regards, John.
 
I'm not exactly sure what it is that you are trying to do but maybe you
should be using the TYPE command instead of Echo.

John
 
I'm not exactly sure what it is that you are trying to do but maybe
you should be using the TYPE command instead of Echo.

John

I'm trying to create a config file from a batch file (with different parameters on each pass, but it is not
really important here). Type cannot be used in here, because type will output content from file, I have to
output a string from a batch, which is echo for.

Anyone other?
 
You can use this:
set value=2
echo # whatever>settings.ini
echo --max-time !value!>>settings.ini
Regards.
 
Back
Top