Welcome!

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

SignUp Now!

Are local aliases inherited?

Jun
770
6
The help for "Alias" says, "Whenever you start a second copy of TCC which uses a local alias list, it inherits a copy of the aliases from the previous shell." But, when I try this (see below), the second copy has no aliases. Is the help wrong or am I doing something wrong?

Sometimes a btm file that I write conflicts with an alias that I define. So, I put "unalias *" at the beginning of btm files. But, with a global alias list, I lose my aliases while the btm file is running. So, I tried local aliases. They work pretty well, but I have one btm file where I want to do

start /c /inv Foo

where Foo is an alias defined in the same btm file. With local aliases, the second copy of TCC that "start" starts sees foo as undefined. Is there an alternative to making foo a btm?

C:\>unalias *

C:\>alias
TCC: No aliases defined

C:\>alias foo=dir

C:\>alias
foo=dir

C:\>"c:\Program Files\JPSoft\TCmd11\TCC.exe"

TCC 11.00.52 Windows Vista [Version 6.0.6002]
Copyright 2010 Rex Conn & JP Software Inc. All Rights Reserved
Registered to davidmarcus - 1 System License

C:\>alias
TCC: No aliases defined

C:\>ver /r

TCC 11.00.52 Windows Vista [Version 6.0.6002]
TCC Build 52 Windows Vista Build 6002 Service Pack 2
Registered to davidmarcus - 1 System License
 
---- Original Message ----
From: David Marcus
To: [email protected]
Sent: Tuesday, 2010. October 26. 19:19
Subject: [Support-t-2369] Are local aliases inherited?

| The help for "Alias" says, "Whenever you start a second copy of TCC
| which uses a local alias list, it inherits a copy of the aliases from
| the previous shell." But, when I try this (see below), the second
| copy has no aliases. Is the help wrong or am I doing something wrong?
|
| Sometimes a btm file that I write conflicts with an alias that I
| define. So, I put "unalias *" at the beginning of btm files. But,
| with a global alias list, I lose my aliases while the btm file is
| running. So, I tried local aliases. They work pretty well, but I have
| one btm file where I want to do
|
| start /c /inv Foo
|
| where Foo is an alias defined in the same btm file. With local
| aliases, the second copy of TCC that "start" starts sees foo as
| undefined. Is there an alternative to making foo a btm?
|
| C:\>unalias *
|
| C:\>alias
| TCC: No aliases defined
|
| C:\>alias foo=dir
|
| C:\>alias
| foo=dir
|
| C:\>"c:\Program Files\JPSoft\TCmd11\TCC.exe"
|
| TCC 11.00.52 Windows Vista [Version 6.0.6002]
| Copyright 2010 Rex Conn & JP Software Inc. All Rights Reserved
| Registered to davidmarcus - 1 System License
|
| C:\>alias
| TCC: No aliases defined
|
| C:\>ver /r
|
| TCC 11.00.52 Windows Vista [Version 6.0.6002]
| TCC Build 52 Windows Vista Build 6002 Service Pack 2
| Registered to davidmarcus - 1 System License

There are two primary ways to start a new instance of TCC from a running instance: using the START command, and just executing %_CMDSPEC. The rule of inheriting local aliases by the new instance of TCC applies only to the second method. Using the START command is equivalent to starting TCC from a desktop icon, and it will inherit only the environment, and that only if the /I option is NOT used.
I have struggled with the limitation of SETLOCAL - when using global aliases, any alias changes between SETLOCAL and its corresponding ENLOCAL (explicit or implicit) affect all concurrent instances of TCC which use global aliases, though only until the ENDLOCAL is executed. Two overlapping batch files in different TCC instances can permanently alter the global aliases. Basically I learned to use only global aliases, and never to "temporarily" kill all aliases (using unalias * within a SETLOCAL block). This makes it more difficult to adopt batch files written by others. The real solution is not to have any alias name that masks an internal command. It is a practice I preach, but do not follow...
Batch files never interfere with aliases, because aliases have priority over batch file names (and even over internal commands and executables). You probably intended to mean an alias which interferes with the name of a batch file. The solution is simple: either use the full file specification of the batch file, or prefix the name with asterisk * .
--
Steve
 
I meant I wrote a batch file that didn't work because, e.g., I had created an alias outside the batch file that hid the "return" statement.

I tried just executing tcc.exe, as the example I posted shows. The aliases were not inherited.

C:\>alias
TCC: No aliases defined

C:\>alias foo=dir

C:\>"%_cmdspec"

TCC 11.00.52 Windows Vista [Version 6.0.6002]
Copyright 2010 Rex Conn & JP Software Inc. All Rights Reserved
Registered to davidmarcus - 1 System License

C:\>alias
TCC: No aliases defined

C:\>exit

C:\>alias
foo=dir
 
On Tue, 26 Oct 2010 20:13:10 -0400, David Marcus <> wrote:

|I tried just executing tcc.exe, as the example I posted shows. The aliases were not inherited.

I can duplicate that. It would seem that a local-alias instance does not
inherit local aliases from a local-alias instance.

v:\> d:\tc12\tcc.exe /la

TCC 12.00.30 Windows XP [Version 5.1.2600]

v:\> alias
TCC: No aliases defined

v:\> alias foo bar

v:\> alias
foo=bar

v:\> d:\tc12\tcc.exe /la

TCC 12.00.30 Windows XP [Version 5.1.2600]

v:\> alias
TCC: No aliases defined
 

Similar threads

Back
Top