aliases disappearing

May 12, 2014
31
0
#1
If my TC command window (tabbed) is open when I shut down or restart my computer, when I next launch TC, I have no aliases. History and dirhistory are intact, but aliases.txt has become a zero-byte file. Fortunately I keep a backup copy, but it is annoying to have to close TC before shutting down or restarting my computer. I generally keep the TC window open during my entire Windows session.
 
#2
The TCC OPTION dialog has allows specifying a history file and a dirhistory file. I couldn't find a place to specify an alias file. How are you specifying it and how are you populating it with aliases?
 
May 12, 2014
31
0
#3
The TCC OPTION dialog has allows specifying a history file and a dirhistory file. I couldn't find a place to specify an alias file. How are you specifying it and how are you populating it with aliases?
In TCSTART.BTM, I have:

alias /r "C:\Program Files\JPSoft\tcmd17x64\aliases.txt"

and in TCEXIT.BTM:
alias > "C:\Program Files\JPSoft\tcmd17x64/aliases.txt"
alias |! sort > "C:\Program Files\JPSoft\tcmd17x64\aliases.txt"

I have no problems if I remember to close TCC before I shut down or restart the computer.
 
#4
1. You may not (probably don't) have "write" permissions in "c:\program files". Where are your history and dirhistory files?

2. A few years ago there was an issue with TCEXIT not being processed on logoff/shutdown. I'm pretty sure that remains fixed (my TCEXIT is processed on logoff/shutdown). On logoff or shutdown, TCEXIT won't be given forever. By default it gets 5 seconds. If your TCEXIT takes longer than that, it'll be cut off.
 
May 12, 2014
31
0
#5
This makes no sense to me. ALIASES.TXT doesn't become a zero-byte file when it's read into memory when TCC loads, and if I terminate TCC manually, the aliases are there for the next session. What is creating a zero-byte file if not TCEXIT.BTM, ignoring the aliases that are already in memory?
 
May 12, 2014
31
0
#7
1. You may not (probably don't) have "write" permissions in "c:\program files". Where are your history and dirhistory files?

2. A few years ago there was an issue with TCEXIT not being processed on logoff/shutdown. I'm pretty sure that remains fixed (my TCEXIT is processed on logoff/shutdown). On logoff or shutdown, TCEXIT won't be given forever. By default it gets 5 seconds. If your TCEXIT takes longer than that, it'll be cut off.
All of my TCC files are in "C:\Program Files\JPSoft\tcmd17x64\"
 
Last edited:
May 12, 2014
31
0
#8
I have apparently solved the problem. It appears to have been caused by an innocuous little utility I installed some time ago called Simple System Tweaker. One of the things it did was radically shorten the time allowed for services to stop at shutdown/restart to something like 2 seconds. Fortunately it backed up the registry for me, so I was able to undo the changes it made and the missing aliases problem disappeared.
 
#14
Unfortunately, the problem has returned, and I don't know why. If I shut down or restart the computer without first closing TCC, aliases.txt has zero bytes on restart.
I noticed that you have
Code:
alias > "C:\Program Files\JPSoft\tcmd17x64/aliases.txt"
alias |! sort > "C:\Program Files\JPSoft\tcmd17x64\aliases.txt"
That's odd. Does either of those alone work?
 
May 12, 2014
31
0
#15
I think not. I am an administrator running under UAC,
Code:
v:\> echo foo > "c:\Program Files"\foo.log
TCC: (Sys) Access is denied.
"C:\Program Files\foo.log"
And this relates to my problem exactly HOW?

First of all, you didn't include the entire path/file name in quotes.

Secondly:

Sat Mar 28, 2015 8:26:41p C:\Program Files >echo foo > test.log

Sat Mar 28, 2015 8:26:49p C:\Program Files >type test.log
foo
 
#19
Yes, they do.

I have a feeling that you do not comprehend my problem.
I meant do they work alone when shutting down without closing TCMD. I don't understand the need for two commands; the second one, if successful, will overwrite the file.
I understand the problem to be ... normally (simply closing TCMD), you get a file with your aliases in it; but when shutting down without closing TCMD, the file is empty.
There are many things I can't test.
Does the same thing happen with stand-alone TCC?
You could put some diagnostics in TCEXIT to try to figure out exactly what fails, and when it fails; for example, do "2>>error.log" in each "alias" command to capture any errors. And/or, after each ALIAS command, do `DIR "C:\Program Files\JPSoft\tcmd17x64\aliases.txt >> dircheck.txt"`to see when the file is emptied.
 

samintz

Scott Mintz
May 20, 2008
1,270
11
Solon, OH, USA
#21
If your alias list rarely changes (as is the case with me) then I'd bypass the issue altogether by *not* saving your alias list in TCEXIT. If you modify your aliases then manually update your alias.txt file.

If you still need to save aliases on every exit, then simplify it by eliminating the sort and only do the redirect. And move it to the beginning of your TCEXIT file. If you desire to see a sorted alias list then create an aliaslist command that does "*alias | sort".

Code:
alias al=alias
al ad=al | sort
al as=al > "C:\Program Files\JPSoft\tcmd17x64\aliases.txt"
 
#23
And then there's SHRALIAS. It keeps aliases (history, dirhistory, functions) in memory when no TCCs are running, eliminating the need to load/save in TCSTAR/TCEXIT. It automatically saves those lists to files on logoff and shutdown. I start SHRALIAS at logon and simply forget it. I couldn't do without it.