Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Coexistence of TCC-RT and TCC/TCMD

Following Joe Caverly's suggestions, I now have TCC-RT running nicely in a quasi-interactive mode. But something very puzzling is happening. I launch TCC-RT in a CMD session in Windows Terminal with the /L option so that local aliases and functions will be used. When I run the ALIAS command, it reports that there are no aliases defined. But that is not true. My regular aliases all work, including my shorthand directory alias D. I can even run UNALIAS *. It makes no difference. How can it be that TCC reports that there are no aliases and then run all my global aliases?

1784647357213.webp
 
In the previous session, I had unloaded SHRALIAS, so I would not have expected TCC-RT to be able to pick up global aliases. However, the culprit may be Windows Terminal. It was initially launched with SHRALIAS loaded, and it opened with a TCC tab. I then opened a CMD tab and did what was shown in the previous post. When I changed Windows Terminal to open with CMD as its default profile, and I opened it after unloading SHRALIAS, TCC-RT did open with no aliases.

Code:
c:\tcmd\tccrt>start_tccrt
[TCC-RT 36.50.70 C:\tcmd\tccrt]
>alias
TCC: C:\tcmd\tccrt\tccrt_interactive.btm [10]  No aliases defined
[TCC-RT 36.50.70 C:\tcmd\tccrt]
>which d
d is an unknown command
[TCC-RT 36.50.70 C:\tcmd\tccrt]
>

Nevertheless, that does not explain how/why the ALIAS command can report that there are no aliases when there are aliases, ones that actually work perfectly well.
 
Code:
@SETLOCAL
@ECHO OFF

iff %_tccrt eq 0 then
  echo Do not run %_batchname from TCC.
  echo Run %_batchname using TCC-RT from a non-TCC shell.
  quit
endiff

iff %_tccrt eq 1 then 
  echo Shralias.exe loaded: %@if[isapp Shralias.exe,Yes,No]
  echo.
  echo TCC-RT Alias Startup Values (no TCMD.INI file)
  echo Global Aliases: %@option[GlobalAliases]
  echo Local  Aliases: %@option[LocalAliases]
  echo.
  echo Setting GlobalAliases=Yes
  option //GlobalAliases=Yes
  echo Setting LocalAliases=No
  option //LocalAliases=No
  echo.
  echo After using option//
  echo Global Aliases: %@option[GlobalAliases]
  echo Local  Aliases: %@option[LocalAliases]
  unalias *
  unfunction *
endiff

alias
function
ENDLOCAL

Output:
Code:
PS U:\> tccrt r:\test.btm
Shralias.exe loaded: Yes

TCC-RT Alias Startup Values (no TCMD.INI file)
Global Aliases: No
Local  Aliases: Yes

Setting GlobalAliases=Yes
Setting LocalAliases=No

After using option//
Global Aliases: Yes
Local  Aliases: No
TCC: R:\test.btm [29]  No aliases defined
TCC: R:\test.btm [30]  No functions defined
PS U:\>

After running SHRALIAS /U from TCC,
then running TCC-RT from PowerShell 5.1;

Code:
PS U:\> tccrt r:\test.btm
Shralias.exe loaded: No

TCC-RT Alias Startup Values (no TCMD.INI file)
Global Aliases: No
Local  Aliases: Yes

Setting GlobalAliases=Yes
Setting LocalAliases=No

After using option//
Global Aliases: Yes
Local  Aliases: No
TCC: R:\test.btm [29]  No aliases defined
TCC: R:\test.btm [30]  No functions defined
PS U:\>

I still think it is best to only declare the ALIASes that you want to use in the .btm that will be run by TCC-RT,
and remove the ALIASes that TCC defined.

Note that you can run SHRALIAS /U from TCC-RT,
which will affect any running instances of TCC.

Joe
 
The INI file is the same for all variants:

%AppData%\Local\JPSoft\TCMD.INI

I have these settings for running .BTM files:

Code:
$ ASSOC .btm
.btm=takecommand.script

$ FTYPE takecommand.script
takecommand.script="C:\Programs\TCC-RT\tcc.exe" /B /C "%1" %*

$ set PATHEXT
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PS1;.PSC1;.MSC;.BTM;.PHP;.PHAR;.SH
 
Back
Top