SET /A question; HELP nits

May 20, 2008
3,515
4
Elkridge, MD, USA
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
 
May 20, 2008
11,401
99
Syracuse, NY, USA
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`".
 

rconn

Administrator
Staff member
May 14, 2008
12,345
150
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.

No (CMD.EXE compatibility issue).

But there's no reason to use SET /A unless you're writing batch files for CMD.EXE.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
---- 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
 

rconn

Administrator
Staff member
May 14, 2008
12,345
150
* document the operators available using SET /A that are not available in @EVAL, e.g., +=, /=, etc.

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.
 
May 20, 2008
3,515
4
Elkridge, MD, USA
| 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
 
May 20, 2008
11,401
99
Syracuse, NY, USA
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]
 

rconn

Administrator
Staff member
May 14, 2008
12,345
150
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
Thread starter Title Forum Replies Date
vefatica SET question Support 16
V Set path permanently from within TCC? Support 3
S Debugger keeps breaking with no break point set. Support 1
Joe Caverly Set a batch variable (%1 - %n) when TCC is executing a batch file Support 5
R How to? Set default application in a special folder Support 4
A How to? Set up SMTP password in TCC-RT Support 1
vefatica WAD More SET /A woes Support 4
vefatica SET /A and multidimensional array. Support 1
M How to set Path variable for non-executable file extensions in 4DOS Support 8
D Need to set Take Command font size when switching to high DPI display Support 0
P "Set" command behavior - a bug? Support 3
M How to? Set the ribbon titles to mixed case Support 1
X How to set %_INIREAD result to variable Support 5
M WAD Set statements in () causes problems Support 8
M How to? How to set a default TITLE for newly opened tab? Support 2
M Fixed Set "VAR=VAL" format causes problems Support 12
vefatica SET /A var=expression=digits Support 3
cxxl Set encoding for batch file Support 4
B TCC 21.01.50 Problem with ALIAS /r and SET /r Support 2
vefatica SET /A var\=...? Support 10
dcantor Documentation SET /T: missing from heading Support 0
fpefpe Documentation Set /v Support 4
vefatica What's SET /Z? Support 1
R Fixed set /r has stopped working in build 35 Support 4
BeechComer Debugger: how to set %1 variable? Support 3
fpefpe How to? Global variable set /v Support 4
fpefpe Documentation Can the title line of tcmd be set? Support 4
J How to set working directory Support 10
Jay Sage Failure of ACTIVATE to Set a Window Position Support 3
rps Fixed Win "set /p" not working in V17 build 53 Support 3
vefatica SET /A "var%=N", TCC vs. CMD Support 0
J Set environment variable from stdout of command Support 3
B How to? Pre-set _tcfolder on startup when Folders is set Auto-Hide Support 6
Dan Glynhampton Fixed @version "force" flag not working, and unable to set separator Support 3
R WAD /= size ranges not set correctly Support 5
S How to? Set the timestamp of ZIP command built archive to match latest member Support 8
Mordachai Help! How to set parameters for script I'm debugging?! Support 6
Roedy SET= Support 2
A How to? Set up a log file for all command output Support 3
M Fixed character set in dir/copy Support 3
Phileosophos Fixed TakeCommand exits upon "set [" command Support 14
R How to set comspec to point to cmd.exe? Support 5
S WAD SET problem - array element initialization Support 11
C Wildcard expansion in FOR set Support 27
T Set 1% then Echo 1% Support 9
noahcoad copy /w to FTP does not set time stamp Support 1
M A request for a new feature for the "set" command... Support 5
cgunhouse Accessing variables set using SET /U or SET /S Support 3
D Force For to treat set of values as text, not files Support 3
vefatica Regular expressions in FOR's set? Support 10

Similar threads