aliases disappearing

May 12, 2014
31
0
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.
 
May 20, 2008
11,547
107
Syracuse, NY, USA
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
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.
 
May 20, 2008
11,547
107
Syracuse, NY, USA
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
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
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
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.
 
May 12, 2014
31
0
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.
 
May 20, 2008
11,547
107
Syracuse, NY, USA
I believe writing to c:\program files\ is allowed if it's an INI,TXT, or LOG file - though I could be wrong...
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"
 
May 20, 2008
11,547
107
Syracuse, NY, USA
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
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
 
May 12, 2014
31
0
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?

Yes, they do.

I have a feeling that you do not comprehend my problem.
 
May 20, 2008
11,547
107
Syracuse, NY, USA
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
I was replying to Charles G.
 
May 20, 2008
11,547
107
Syracuse, NY, USA
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,514
18
Solon, OH, USA
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"
 
May 20, 2008
11,547
107
Syracuse, NY, USA
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.
 
Similar threads
Thread starter Title Forum Replies Date
Jay Sage Parameter %$ Different in Aliases and BTMa Support 4
vefatica Questions about aliases. Support 1
Jay Sage Request Re Aliases CD_LEAVE and CD_ENTER Support 2
Joe Caverly Expand all aliases on the command line Support 2
S Take Command crashes for aliases with length > 1015 Support 1
Joe Caverly SETLOCAL removes Aliases and Functions Support 3
vefatica Two @FUNCTIONs/aliases with the same name Support 4
D Can ANSI escape sequences be used in keystroke aliases? Support 8
Joe Caverly Documentation Aliases Overview Support 3
vefatica Display of special characters in aliases. Support 25
J Autoexecute Keystroke Aliases Support 1
vefatica Aliases ... appending unused parameters? Support 2
cgunhouse Problem with CALL and Directory Aliases in V17 Support 9
MickeyF WAD 'if' and aliases don't mix so well Support 5
M How to? Logic in aliases... Support 3
J Saving aliases Support 21
vefatica Backquotes, aliases get 'em, BTMs don't? Support 1
vefatica Aliases global vs. local Support 12
R key aliases no longer working Support 2
newbie Test to ensure aliases are loaded Support 6
D Are local aliases inherited? Support 4
T FTP.CFG file aliases Support 5
vefatica @@key aliases cause new prompt? Support 16
J TCC Out of memory with aliases and functions Support 5
J Problem with aliases Support 6
P Quick help for aliases Support 3
R Alt-key aliases? Support 3
J Files Disappearing During Batch Execution Support 4
Peter Bratton Disappearing functions Support 1

Similar threads