How to? retain command history across reboot?

Apr 28, 2021
1
0
I all need from your products is to have the ability to retain the command history in both CMD and PowerShell.

I found it to difficult to achieve this simple goal with you product. I am using Windows 10 and I have installed the following list of products and I am using them in trial mode:

Take Command v27 (64-bit installer)
TCC v27 (64-bit installer)
CMDebug v27 (64-bit installer)
TCC-RT v27 (64-bit installer)

In linux, every time I start a terminal window, my command is recorded to my .bash_history file. Can your product provide a similar solution? Is there a simple step-by-step guide to do that?

Thanks
 
From the help file (HISTORY);
If you need to save your command history at the end of each day's work, you might use the first of these commands in your TCSTART.BTM or other startup file, and the second in TCEXIT.BTM:

if exist c:\histfile history /r c:\histfile

history > c:\histfile

This restores the previous history list if it exists, and saves the history when TCC exits.

TCC can also load and save the history list automatically if you use the History File configuration option.

See History File for the automatic method.

Joe
 

samintz

Scott Mintz
May 20, 2008
1,476
15
Solon, OH, USA
The HISTORY command will save the command history for TCC. It does nothing for CMD or Powershell which are their own products. While pretty much any console app can run in a TakeCommand tabbed window, Tcmd itself has no control over the apps own command line history.
For CMD, the DOSKEY command is used for command history, although I don't know how to reload old history.
For Powershell, the Get-History command will return the list of commands you've entered. And Add-History can be used to restore it.

TakeCommand has the "Command Input" window where you can keep a list of commonly used commands. And it lets you copy and paste to that window. From the help:
Take Command Command Input Window
The Command Input window allows you to create and edit commands before sending them to the active tab window. This is not limited to entering something at the command prompt; you can feed strings anywhere a console app is expecting input. You can scroll back to previous lines, edit, and reexecute them. The Command Input window also has full undo/redo (up to 31 levels). You can automatically save the contents of the Command Input window when Take Command exits, and reload it when Take Command starts (see Auto Save File).
 
May 20, 2008
11,185
94
Syracuse, NY, USA
This product will not (cannot) help you with the command history of CMD or PowerShell.

If you use a global command history (and other lists) and SHRALIAS, whatever lists SHRALIAS is guarding (history, dirhistory, alias, function) are saved at logout/shutdown.

PowerShell has a built-in save/reload command history mechanism. Google for ".ps_history" for more information.
 
May 20, 2008
11,185
94
Syracuse, NY, USA
For Powershell, the Get-History command will return the list of commands you've entered. And Add-History can be used to restore it.
Scott, I have these lines in my profile.ps1.

Code:
#$HistoryFilePath = Join-Path ([Environment]::GetFolderPath('UserProfile')) .ps_history
#Register-EngineEvent PowerShell.Exiting -Action { Get-History | Export-Clixml $HistoryFilePath } | out-null
#if (Test-path $HistoryFilePath) { Import-Clixml $HistoryFilePath | Add-History }

They are commented out but I still have a working history save/reload history mechanism in PowerShell. Do you know what's going on?
 
Jun 2, 2008
345
3
I am using Windows 10 and I have installed the following list of products and I am using them in trial mode:

Take Command v27 (64-bit installer)
TCC v27 (64-bit installer)
...

No need for TCC separately because Take Command comes with its own TCC.