How to? Maintain command line history between reboots

Jul 6, 2012
9
0
Hi.

I'm trying to keep command line history between reboots with shralias.
Currentlly I have logging enabled and tcstart.cmd file with this:
echo off
ShrAlias 2>> NUL
color green on bri white
echo on

Attached config file.
it works fine for one windows session, but i after i reboot there is no history available.

I'm on win7 x64 sp1 TCC LE 13.04.63, running under admin account with no uac.

Thanks, Oleg.
 
Jul 6, 2012
9
0
attaching a file doesn't seem to work so here it is inline:

[4NT]
ProxyPort=80
FirewallType=None
FirewallPort=1080
PassiveFTP=Yes
FTPTimeout=180
HTTPTimeout=180
TFTPTimeout=180
MailPort=25
RLocalPort=0
SHLocalPort=0
SSHPort=22
SSLStartMode=0
SSLPort=0
AmPm=No
BeepFreq=440
BeepLength=2
CommandSep=&
DecimalChar=Auto
DescriptionMax=512
NTFSDescriptions=No
Descriptions=Yes
EscapeChar=^
EvalMax=10
EvalMin=0
ExpandPseudovariables=Yes
ParameterChar=$
RegularExpressions=Perl
SwitchChar=/
TabStops=8
ThousandsChar=Auto
AutoCancel=No
AutoCDD=Yes
AutoRun=Yes
BatchAliases=Yes
BatchEcho=Yes
CMDExtensions=No
CopyPrompt=No
DelayedExpansion=No
DelGlobalQuery=Yes
DirJunctions=Yes
DuplicateBugs=Yes
ExecWait=No
HistLogName=C:\Users\OlegYch\AppData\Local\JPSoft\TCHistoryLog
HistLogOn=Yes
LocalAliases=No
LocalDirHistory=No
LocalFunctions=No
LocalHistory=No
LogAll=No
LogName=C:\Users\OlegYch\AppData\Local\JPSoft\TCCommandLog
LogOn=Yes
LogErrors=Yes
LogErrorsName=C:\Users\OlegYch\AppData\Local\JPSoft\TCErrorLog
MouseWheel=Yes
NoClobber=No
PathExt=No
Perl=No
Python=No
RecycleBin=No
Rexx=No
Ruby=No
SettingChange=No
SHChangeNotify=No
Tcl=No
UnicodeOutput=Yes
UnixPaths=Yes
UpdateTitle=Yes
WebHelp=No
Win32SFNSearch=No
Wow64FsRedirection=Yes
ZoneId=0
ANSI=No
CDDWinLeft=20
CDDWinTop=20
CDDWinWidth=300
CDDWinHeight=140
PopupWinHeight=400
PopupWinTop=10
PopupWinLeft=40
PopupWinWidth=400
WindowHeight=0
WindowState=Standard
WindowWidth=0
WindowX=0
WindowY=0
Transparency=255
InactiveTransparency=255
AppendToDir=Yes
CompleteHiddenFiles=Yes
CompleteHiddenDirs=Yes
CompletePaths=Yes
CompletePercents=No
CursorIns=100
CursorOver=15
DirHistory=12288
DirHistoryOnEntry=No
EditMode=InitInsert
FuzzyCD=0
HistMin=0
History=28672
HistCase=No
HistCopy=No
HistDups=Off
HistMove=No
HistWrap=Yes
ServerCompletion=Local
[PopupFont]
Font=Consolas
Size=-12
Weight=400
Italic=0
Script=204
 
Aug 2, 2011
258
4
Berlin, Germany
Hello Oleg,

corresponding to tcstart.btm you can use a tcexit.btm.
So in tcstart you can issue
Code:
history /r myhistory.log
log  /h /w myhistory.log
and in the tcexit
Code:
history > myhistory.log

HTH
 
Jul 6, 2012
9
0
Hi Frank, thanks for the hint!
So I don't need to use shralias in this case? i'm ok if the history is not shared between several sessions running at the same time (actually i'd prefer this behavior)
if i don't run shralias and run several sessions will the history of the last closed session overwrite other sessions histories?

i'm trying to duplicate default bash behavior...
 

Charles Dye

Super Moderator
Staff member
May 20, 2008
4,460
88
Albuquerque, NM
prospero.unm.edu
I know that SHRALIAS will save its state to disk when it exits if you set an environment variable SHRALIAS_SAVE_PATH. However, I don't know what the best way is to reload those files at startup. (I don't use any global lists myself, and I wouldn't want histories to survive a reboot.)
 
Aug 2, 2011
258
4
Berlin, Germany
Oleg,
I have not used or tested it before.
I propose you figure it out and give us the result ;)
 
May 20, 2008
3,515
4
Elkridge, MD, USA
Hi Frank, thanks for the hint!
So I don't need to use shralias in this case? i'm ok if the history is not shared between several sessions running at the same time (actually i'd prefer this behavior)
if i don't run shralias and run several sessions will the history of the last closed session overwrite other sessions histories?

i'm trying to duplicate default bash behavior...
I have never used bash, I can go only on what you wrote in this thread.

If you want individual command histories for concurrent TCC instances, you need to do all of the following:
1/ make command histories local - start TCC.EXE with the /LH option (or set the corresponding directive in your .INI configuration file using the OPTION dialog)
2/ use tcstart.btm to
2.1/ load the history of the previous session: HISTORY /R logfile
2.2/ specify a command log file: LOG /H /W logfile

You do not need to run SHRALIAS for this operation, nor do you need to explicitly save history in TCEXIT - it will all be there in the logfile, which can grow to be infinitely large.

However, you run into the issues that
1/ you want to generate a unique name for the history file for each concurrent instance, and
2/ how do you find out which one of them to load when a new instance is started.

Issue 1/ is why you need to generate the log file name in TCSTART.BTM - cannot use the configuration directives. One simple method is to use files history.000 ... history.nnn where you set the limit how many different files you want (nnn+1), and use the advanced capabilities of TCC to assign the next available one.
 
Aug 2, 2011
258
4
Berlin, Germany
You do not need to run SHRALIAS for this operation, nor do you need to explicitly save history in TCEXIT - it will all be there in the logfile, which can grow to be infinitely large.
Of course my advice with tcexit was saying the same thing twice over.
 
Jul 6, 2012
9
0
Thanks, guys!

Using /lh with HISTORY /R logfile and LOG /H /W logfile seems to do exactly what i want.
Every command gets appended into log so when i open a new shell every command gets loaded, but the commands entered in current shell don't affect other currently running sessions.

Thanks again, Oleg.
 
Similar threads
Thread starter Title Forum Replies Date
Jesse Heines Request for TCC Date Command Custom Format Example TCC/LE Support 4
A vcvarsall.bat command not working on TCC LE command prompt TCC/LE Support 16
T Cursor-up for last command TCC/LE Support 4
B A command crash report TCC/LE Support 1
B Copy command to set timestamp not working in TCC/LE TCC/LE Support 5
D The output of apm command is disordered. TCC/LE Support 1
M Bug in RENAME and KEYSTACK command? TCC/LE Support 9
C WAD Executing rename.py -y trigger internal rename command TCC/LE Support 5
G WAD Windows 10 - ver command TCC/LE Support 6
C Incompatibility with cmd.exe dir command TCC/LE Support 3
S Take Command 16.00.45 update crashed TCC/LE Support 2
A command typed? TCC/LE Support 12
O Redirection in for command does not work TCC/LE Support 7
CaptainFlint Command grouping differs from cmd? TCC/LE Support 22
S Fixed TCC-LE 13.05.65 x64 "option" command tabs broken TCC/LE Support 4
G unknown command (newbie post - be gentle) TCC/LE Support 3
Charles Dye ? command, TCC/LE vs. supported TCC/LE Support 3
C How to close Take Command? TCC/LE Support 2
Frank a question to "Take Command 13.04.52 Released" TCC/LE Support 3
J Help with Log Command TCC/LE Support 1
R How to? Add TCC Open command box here to context menu TCC/LE Support 2
jason404 Is there a command equivalent to ls -a in bash? TCC/LE Support 3
fpefpe time command -- time server TCC/LE Support 3
G What does this error means: TCC: Unknown command "C:\Program" TCC/LE Support 13
T trouble with start /runas command TCC/LE Support 1
M How to? Color input line TCC/LE Support 6
jason404 Is it possible to have a two line prompt? TCC/LE Support 5
J Multi line for nested in a multi line if TCC/LE Support 2
R Substring extraction from each line of CSV file TCC/LE Support 2

Similar threads