Windows – .history file on Windows machines

command-line-interfacepowershellwindows

Is there an auditable file on a Windows machine that shows the command-line history for either cmd or PowerShell? On UNIX machines I believe there is a hidden file in the home directory called .history.

Best Answer

For plain old cmd, no there really isn't anything like that.

Even under PowerShell, I believe the history is still limited to the lifetime of the PowerShell session, though it gives you the functionality to work with and export the history, and even load it. You can use that to create some helper scripts to load and save your history easily as demonstrated here, but nothing out-of-the-box.