setlocal
echo OsBuild=%_OSbuildEx
which cl_grep
cl_grep
call dummy.btm
set _key=HKCU\AppEvents\Schemes\Apps\.Default\AppGPFault
do c in /P `regdir /dfv %_key | CL_grep -i ".current[\]"`
echo %c
enddo
endlocal
dummy.btm
Code:
setlocal & echo Dummy Text & endlocal
quit
Call DO_P gives:
Code:
OsBuild=22000.376
CL_grep is an alias : "CLPath:\grep.exe"
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
This Dummy Text
TCC: R:\do_P.btm [10] Unknown command "CLPath:\grep.exe" -i ".current[\]"
If we remove the dummy call in DO_P it works
or we remove the setlocal from dummy.btm
or we redefine the alias CL_grep to %@ALIAS[CLPATH:]\grep.exe
It's OK here with TCC 28.02.18 (and back to TCC v24), imitating your example the best I can. The grep error message is coming from line 4 where CL_grep is called with no arguments. Otherwise, I think this (below) is what's expected. From the TCC error message I'd guess is that the CLPath: alias does not exist or is not referenced correctly. If your TCC is not up to date, it might be a bug that has been fixed.
Code:
v:\> alias CLPath:
d:\gnu
v:\> alias CL_grep
CLPath:\grep
v:\> type niros1.btm
setlocal
echo OsBuild=%_OSbuildEx
which cl_grep
cl_grep
call dummy.btm
set _key=HKCU\AppEvents\Schemes\Apps\.Default\AppGPFault
do c in /P `regdir /dfv %_key | cl_grep -i ".current[\\]"`
echo %c
enddo
endlocal
v:\> type dummy.btm
setlocal & echo Dummy Text & endlocal
quit
v:\> niros1.btm
OsBuild=19044.1415
CL_grep is an alias : CLPath:\grep
Usage: d:\gnu\grep [OPTION]... PATTERN [FILE]...
Try `d:\gnu\grep --help' for more information.
Dummy Text
HKCU\AppEvents\Schemes\Apps\.Default\AppGPFault\.Current\ : REG_SZ :
TCC Version 28.02.18 x64 and the aliases are global.
Just before the DO /P the command CL_grep is executed with no parameter so the command executes and the CLPATH: is resolved.
Maybe the global /local aliases makes the difference.
CL_grep is run in a new instance of TCC. With global aliases, that should be OK. Do you use a TCSTART.BTM? If so, does it do anything that might mess with the aliases?
TCSTART.BTM is used and there the aliases are loaded if not already defined.
Also the library file and functions are loaded at first start of a TCC session.
Here's a simple test. It will show you if you have the CL* aliases in a piped instance of TCC. You could also put that in your BTM right before the DO with the failing call to CL_grep.
In nested 'setlocal''s the secondary shell does not get the global aliasses.
Workaround for now by changing TCSTARTUP.BTM
Removed the /GL switch from the function command for the no function message
Removed the %_SHELL == 0 test so the aliasses can be loaded (if necessary) in secondary shells.
I also see that it works without the call to DUMMY.BTM. And it works if DUMMY.BTM doesn't setlocal/endlocal.
Somehow, the CALL to a BTM with SETLOCAL/ENDLOCAL is messing up the alias expansion. That seems wrong. If I can't find a quick fix, I'll condense the problem into something small and start a new thread. Hopefully, Rex will chime in.
I guess we're back at the beginning of this thread.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.