%= gets changed to ^ in a double quoted string

Sep 29, 2021
3
0
Hi,

I've found an error while executing the Visual Studio VsDevCmd.bat on TCC LE 14.00.9 x64 Windows 10 [Version 6.3.19041].

The error happens while executing a line like this:

set "%__NORMALIZE_VAR%=%__NORMALIZE_VAR_CONTENT:~0,-1%"

But it can be easily reproduced just typing this command

echo "%os%=xx"

and noting that the %= character combinations gets replaced by the ^ character, thus echoing something like

"Windows_NT^xx"

Note also that the problem only occurs when using double quotes. Otherwise, executing the command like this

echo %os%=xx

Will produce the expected output:

Windows_NT=xx

Or, if you keep the quotes but separate the characters like this:

echo "%os% =xx"

there is no substitution:

"Windows_NT =xx"

Is that substitution simply a bug or is it expected as part of some functionality (couldn't find it)? In case it is an expected behavior, how can it be avoided? Some escaping? Can't use the blank space as a work around because it also gets included in the output and would get the original set command invalid.

Regards,
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,596
97
Albuquerque, NM
prospero.unm.edu
%= is a long-standing TCC variable which expands to the current command separator. (This feature dates back to 4DOS days. 4DOS and 4NT used different command separators by default.)

You can disable this feature if you like. OPTION to open the configuration dialog, select the "Advanced" tab, and then turn off the tick box labelled "Expand pseudovariables".
 
Sep 29, 2021
3
0
Hi, thanks a lot for your help!

Found this page referring to %= as a pseudovariable for the Escape Character (which in this case is ^), so that explains the problem:

I could not disable it on the configuration dialog (the "Special Characters" group appears as disabled, not sure why) but did so by changing to ExpandPseudovariables=No in the %LocalAppData%\JPSoft\TCMD.INI file.

Tks!
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,596
97
Albuquerque, NM
prospero.unm.edu
Hi, thanks a lot for your help!

Found this page referring to %= as a pseudovariable for the Escape Character (which in this case is ^), so that explains the problem:

Whoops — my mistake! Yes, %= is the escape character, not the command separator.