set /a question

A

ALF

Hi, any ideas as to why when I used set /a
totalfile=2,000+1,500 it gives me wrong answer. but when I
remove the comma it works fine. Do I miss something?

thanks in advance.

ALF
 
A

Al Dunbar [MS-MVP]

ALF said:
Hi, any ideas as to why when I used set /a
totalfile=2,000+1,500 it gives me wrong answer. but when I
remove the comma it works fine. Do I miss something?

Yes, you missed two things, both taken from set /?:

1) ... the expression evaluator is pretty simple ...

2) the comma is an "expression separator", not a "thousands" separator.

So when totalfile received a value of 2, set/a was simply returning the
first expression from the comma separated list, as per the documentation.

/Al
 
M

Mark V

In microsoft.public.win2000.cmdprompt.admin Al Dunbar [MS-MVP]
wrote:
Yes, you missed two things, both taken from set /?:

1) ... the expression evaluator is pretty simple ...

2) the comma is an "expression separator", not a "thousands"
separator.

So when totalfile received a value of 2, set/a was simply
returning the first expression from the comma separated list, as
per the documentation.

ALF,
In the case of DIR (W2K) output it may help to use "/-C"

/C Display the thousand separator in file sizes.
This is the default.
Use /-C to disable display of separator.
 
A

Alf

thanks
-----Original Message-----
In microsoft.public.win2000.cmdprompt.admin Al Dunbar [MS-MVP]
wrote:




Yes, you missed two things, both taken from set /?:

1) ... the expression evaluator is pretty simple ...

2) the comma is an "expression separator", not a "thousands"
separator.

So when totalfile received a value of 2, set/a was simply
returning the first expression from the comma separated list, as
per the documentation.

ALF,
In the case of DIR (W2K) output it may help to use "/-C"

/C Display the thousand separator in file sizes.
This is the default.
Use /-C to disable display of separator.
.
 

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