Returning to the original topic of the /Z option for alias...
I did some experiments with reading aliases from files. With just the /R option, the command reads in the lines. If an alias has already been defined, it is overwritten, so one does not end up with multiple definitions.
With the /Z option added, all existing definitions are removed, and the definitions in the file are added, even if there are multiple definitions for the same alias. When there are multiple definitions, the first definition in the file is the one that is run. Since the /R option adds the new definitions to the end of the list, it is critical to search for -- and remove -- any previous definition.
I've now gone back and done some further experiments after using /R /Z to get two definitions for the same alias.
Code:
TCC(27.01.23): C:\tcmd\ver27>alias /r /z diralias.cfg
TCC(27.01.23): C:\tcmd\ver27>alias | tail /n 3
lap_nergc:=lap_docs:genealogy\conferences\NERGC2011\
zzz=echo Def 1
zzz=echo Def 2
If I now define zzz again, only the first one is replaced. This makes sense, since that's the one that TCC will use, so why waste time looking for more.
Code:
TCC(27.01.23): C:\tcmd\ver27>alias zzz=echo Def 3
TCC(27.01.23): C:\tcmd\ver27>alias | tail /n 3
lap_nergc:=lap_docs:genealogy\conferences\NERGC2011\
zzz=echo Def 3
zzz=echo Def 2
To see how much time it takes to load all of my aliases from the pair of files including all the overhead of duplicate checking, I ran the following a few times.
Code:
TCC(27.01.23): C:\Users\Jay\Dropbox>timer alias /r %tcmddir\alias.cfg %tcmddir\diralias.cfg
Timer 1 on: 0:03:29
Timer 1 off: 0:03:29 Elapsed: 0:00:00.110
TCC(27.01.23): C:\Users\Jay\Dropbox>timer alias /r %tcmddir\alias.cfg %tcmddir\diralias.cfg
Timer 1 on: 0:03:39
Timer 1 off: 0:03:39 Elapsed: 0:00:00.109
TCC(27.01.23): C:\Users\Jay\Dropbox>timer alias /r %tcmddir\alias.cfg %tcmddir\diralias.cfg
Timer 1 on: 0:05:06
Timer 1 off: 0:05:06 Elapsed: 0:00:00.110
The files each have about 1000 lines, a few of which are comments. One would have to have a lot of aliases for this to be an issue.