1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SET /A question; HELP nits

Discussion in 'Support' started by Steve Fabian, May 18, 2011.

  1. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    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
     
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,939
    Likes Received:
    30
    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`".
     
  3. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,854
    Likes Received:
    83
    No (CMD.EXE compatibility issue).

    But there's no reason to use SET /A unless you're writing batch files for CMD.EXE.
     
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,854
    Likes Received:
    83
    Whatever for? It's the same precision as everything else -- i.e., whatever you asked for.
     
  5. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    ---- Original Message ----
    From: vefatica
    To: ESFabian@zenge.org
    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
     
  6. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,854
    Likes Received:
    83
    Definitely not. The wretched syntax is strictly for CMD.EXE compatibility, and I have no intention of propagating it. If you want to write files for CMD, see the CMD docs for SET /A. Otherwise, avoid it.
     
  7. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    | 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
     
  8. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,939
    Likes Received:
    30
    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]
     
  9. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,854
    Likes Received:
    83
    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 ..."
     

Share This Page