Persistent Command History for 4DOS / DOSBox

One thing I like about bash-style shells is the possibility to go back through my command history – even across sessions. 4DOS (which I use in DOSBox-X) can also be configured to keep a history, but it is empty when a new session is started.

Unfortunately, I could not find a solution for this online.
So I had to come up with a fix for this:

Add this to your 4DOS.INI or the [4DOS] section of your DOSBox .INI file:

History = 768
HistLogOn = Yes
HistLogName = C:\TOOLS\4DOS\4DOSHLOG

This will activate logging.

 

Next, add this to your AUTOEXEC.BAT:

history /R C:\TOOLS\4DOS\4DOSHLOG

This will add your history log to the log memory.

 

Lastly, consider adding this alias to your 4START.BTM (this is where my aliases are stored):

alias delhist = history /f ^ del c:\tools\4dos\4DOSHLOG /q

This  alias will clear your history and empty your history log file:

Now you have a persistent command history in 4DOS / your DOSbox installation.