Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

SET /A question; HELP nits

May
3,515
5
SET /A question
Is there a way other than output redirection to NUL to disable result display when the command is executed at the command line? This is esp. relevant to its use in FOR and DO loops.

HELP nits: @EVAL function
* The statement about the special string PI ought to be listed in the "Parameter interpretation" section (possibly in addition to its current listing at trigonometric functions). It ought to be noted what the precision of that value is.
* In the "Other functions" section the function interpretation column does not line up.

HELP nits: SET command /A option
* Make it more explicit that when this option is used in a command line the resulting value is displayed, but not when it is used in a batch file
* document the operators available using SET /A that are not available in @EVAL, e.g., +=, /=, etc.
--
Steve
 
Steve wrote: "Is there a way other than output redirection to NUL to disable result display when the command is executed at the command line? This is esp. relevant to its use in FOR and DO loops."

In "Feedback", I suggested a "/Q(uiet)" option for SET /A for just that purpose. It hasn't received any votes. I (almost?) never want to see the result echoed and would even resent having to type the "/Q" ... I wish no echoing was the default behavior. If available, I'd probably "alias set `*set /q`".
 
---- Original Message ----
From: vefatica
To: [email protected]
Sent: Wednesday, 2011. May 18. 11:26
Subject: RE: [Support-t-2850] Re: SET /A question; HELP nits

| Steve wrote: "Is there a way other than output redirection to NUL to
| disable result display when the command is executed at the command
| line? This is esp. relevant to its use in FOR and DO loops."
|
| In "Feedback", I suggested a "/Q(uiet)" option for SET /A for just
| that purpose. It hasn't received any votes. I (almost?) never want to
| see the result echoed and would even resent having to type the "/Q"
| ... I wish no echoing was the default behavior. If available, I'd
| probably "alias set `*set /q`".

I do not BROWSE, hence I had not seen your suggestion. Despite Rex' claim that FEEDBACK is accessible via email, only comments to my own suggestions are so reported. I could not vote for it anyway, because I have no votes left...

I think there should be separate votes for our own suggestions (actually just an importance ranking), and similarly, we should be able to add up to 3 votes to others' suggestions. without limit. The current voting system penalizes the imaginative! Any limiting of new suggestions is detrimental to product enhancement - that brilliant idea might occur when its inventor has no more votes!
--
Steve
 
| But there's no reason to use SET /A unless you're writing batch files
| for CMD.EXE.

One of the inventions of the C language, incorporated into SET /A, is the simplified syntax when the command's intent is to modify the value of a variable, i.e., its new value is related to its original value, e.g., +=, *=, etc. For example, I am reading a file of transactions, and I want to calculate their sum, I like to type
set /a sum+=%@word[5,%line]
rather than
set sum=%@eval[sum+%@word[5,%line]]

Of course, in batch files (CMD or TCC) the issue does not exist - the two commands above are equally silent. But the above situation exists in complicated command-line FOR commands, where the extra characters not only add to the typing, but - by making the command line longer - make it more difficult to check.
--
Steve
 
On Wed, 18 May 2011 11:49:52 -0400, rconn <> wrote:

|---Quote (Originally by Steve Fabian)---
|SET /A question
|Is there a way other than output redirection to NUL to disable result display when the command is executed at the command line? This is esp. relevant to its use in FOR and DO loops.
|---End Quote---
|
|No (CMD.EXE compatibility issue).
|
|But there's no reason to use SET /A unless you're writing batch files for CMD.EXE.

Other commands are CMD-compatible but have additional options. Is a "/Q(uiet)"
option for SET out of the question? I don't imagine it would be difficult or
costly to implement.

The "?=" versions of SET /A are convenient, especially if the variable name is
long, because in many cases (useful, simple ones, like incrementing) the
variable name doesn't need to be typed in the expression for the new value.

Compare:

set /a GrandTotal+=1
set GrandTotal=%@inc[%GrandTotal]
 
I think there should be separate votes for our own suggestions (actually just an importance ranking), and similarly, we should be able to add up to 3 votes to others' suggestions. without limit. The current voting system penalizes the imaginative! Any limiting of new suggestions is detrimental to product enhancement - that brilliant idea might occur when its inventor has no more votes!

Not a good argument -- you always have the option of withdrawing your prior votes and reassigning them.

If you're unwilling or unable to prioritize your requests, how can I? The current system works very well at preventing the system from being flooded with hundreds of insignificant requests. I've seen a marked reduction in the "feature" requests that begin "I wouldn't ever use this myself, but it might be nice if ..."
 

Similar threads

Replies
4
Views
2K
Back
Top