WAD Setlocal issue


Jul 6, 2008
Setlocal is removing aliases when used in V21.00.28
This is only when using setlocal/endlocal in an alias. Batch files aren't affected.
C:\JPSoft>alias test=`setlocal & ech This is a test alias to determine what aliases are active after issuing a setlocal command
& endlocal`

TCC: Unknown command "ech"

C:\JPSoft>alias ech
if .%1 eq . (ah ech) else (echo. & echo %$ & echo.)
Hopefully this was behavior unintentional. If so, the documentation needs clarification.
V17, V19, & V20 acts as expected. No V18 to test. V20 example:
C:\JPSoft\tcmd20x64>alias test
setlocal & ech This is a test alias to determine what aliases are active after issuing a setlocal command & endlocal


This is a test alias to determine what aliases are active after issuing a setlocal command


Jul 6, 2008
Thanks for the WAD clarification.

I did read the "What's New", as well as other documentation such as Setlocal and Endlocal...

For me, this "copying global aliases to a local list" didn't equate to aliases literally not working within a Setlocal/Endlocal pair used in an alias definition and aliases working when used in a batch file.

If I change to local aliases within an alias before using a Setlocal/Endlocal pair will the specific alias have access to these local aliases without redefining them inside the Setlocal/Endlocal pair?

So does this mean in order to use the copied "local list" I have to reload aliases within the actual alias?

A better question is; how do I use this local alias list within an alias that uses a Setlocal/Endlocal pair?

Is this new behavior something that could be an option to turn on/off? If so, I will add it to the suggestion Forum.

I recommend an explicit clarification be added to the help files. "Aliases do not work with a Setlocal/Endlocal pair within alias definitions. Batch file behavior is not affected."


Jul 6, 2008
SETLOCAL in v21 was changed to preserve global aliases (by request from a number of users). If you use local aliases, you can add/modify/delete them inside the SETLOCAL and the change will be preserved after the ENDLOCAL.
So I tried using local aliases with an alias using a set/endlocal pair.

I don't see that the newly defined alias NEW1 is preserved after the ENDLOCAL as I understand your quoted response above. Clearly I don't understand how this is supposed to work. :banghead:

TCC  21.00.28 x64   Windows 10 [Version 10.0.14393]
C:\JPSoft>alias test5=`alias /L & a New1 & echo. & setlocal & ech Testing.... & alias New1= `echo this is a test of adding alias New1`  &  New1 & endlocal & ech After the endlocal & a New1`
C:\JPSoft>alias /l
          Aliases Beginning with New1*
TCC: Not an alias "New1*"


this is a test of adding alias New1

After the endlocal

          Aliases Beginning with New1*

TCC: Not an alias "New1*"
Just to be clear, here are the aliases used in the above TEST5 alias.
ECH & A both work inside TEST5 once I set LOCAL aliases. They both fail, inside TEST5 without the "alias /L", as I now understand the document.
C:\JPSoft>alias ech
if .%1 eq . (ah ech) else (echo. & echo %$ & echo.)
C:\JPSoft>alias a
 iff .%1 == . then & (ah a) & elseiff isalias %1 then & (fa %1 & echo. & *alias %1) & else & (echo. & Scrput -1 10 Bri Red on W
hi Aliases Beginning with %1* & echo. & *alias %1* & echo.) & endiff
Similar threads
Thread starter Title Forum Replies Date
FreezerBurnt "Missing SETLOCAL" when initializing Visual Studio Command Prompt. Support 9
K seems to have no effec tin CMDebug: SETLOCAL EnableDelayedExpansion Support 1
cgunhouse SETLOCAL not working in BDEBUGGER Support 9
Joe Caverly How to? SETLOCAL Level Support 16
Joe Caverly SETLOCAL removes Aliases and Functions Support 3
vefatica SETLOCAL ... ALIAS ... pipes Support 2
Charles Dye Read-only environment variables wiped by SETLOCAL / ENDLOCAL Support 5
T Documentation SETARRAY & SETLOCAL/ENDLOCAL Support 8
vefatica Command line SETLOCAL? Support 11
Charles Dye Fixed GPF in SETLOCAL Support 16
M How to? Does the "Do" command effectively do a "SetLocal/EndLocal"??? Support 2
H Help for SETLOCAL in TCMD11 Support 0
cgunhouse TCToolBar /W Issue Support 2
G v28 Display Issue Support 7
Jay Sage Issue with CD_ENTER Alias Support 37
Jay Sage Issue with CD_LEAVE Alias Support 3
fpefpe How to? issue with % and evaluation Support 5
cgunhouse Standard User Account Issue Support 2
samintz WAD Display wrapping issue Support 5
M TCC color issue in ConEmu Support 4
samintz Timer issue Support 4
Alpengreis Documentation Minor issue in help file for view /E Support 1
samintz WAD ANSI issue Support 3
D TCSTART issue after reinstallation Support 14
A Documentation [Help file] OPTION "//" synopsis formatting issue Support 0
Chen Touboul Overtyping issue - i press the Insert key, help till press enter for new line in TCC Support 2
Y TCC and Cmder imcompatibility issue Support 7
M Another possibly strange remote registry issue Support 5
T WAD bpokestr issue Support 5
D High-DPI Scaling issue Support 1
S CMDebug 22 issue with del command Support 1
cgunhouse Foldermonitor Issue Support 7
samintz Build 38 Install issue Support 5
Luiz Rodrigues Issue with Maven Support 1
Seven Update / install issue with take command Support 7
Fross WebDav Drive Mapping Issue Support 19
D Upgrade issue Support 3
Fross V20b8 Everything Issue Support 5
T TCC display issue Support 1
cgunhouse _logfile Issue Support 5
T Fixed Querybox issue Support 1
cgunhouse Fixed Share Memory Issue Support 5
cgunhouse Foldermonitor with "/E" Option Issue Support 6
Fross TabComplete Argument Issue Support 1
fpefpe How to? Stange start up issue Support 1
C cosmetic issue with LIST's (I) Support 9
jbarnes1967 TC 18.00 x64 issue with lua io.popen() Support 2
D How to? Wildcards as sets - looping issue with FOR and REN Support 7
T WAD Free issue Support 6
R Fixed v17.0.54 Tab->COMSPEC Dialog Box Issue Support 2

Similar threads