batch: how to echo number to a file

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

John John - MVP

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
 
J

John Doe

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?
 
Joined
Sep 30, 2009
Messages
1
Reaction score
0
You can use this:
set value=2
echo # whatever>settings.ini
echo --max-time !value!>>settings.ini
Regards.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top