PowerShell Previous command history details

Today after executing set of commands I have closed the powerShell console without saving any of the executed commands it is lot of rework to type all the commands once again. In ISE we can save the scripts but it is not the case with powerShell console.

I am not aware that from Powershell version 5 previously executed commands are automatically stored in the location %userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt until I saw the blog http://woshub.com/powershell-commands-history/

This blog explains us that By default, the PowerShell in Windows 10 saves the last 4096 commands that are stored in a plain text file located in the profile of each user %userprofile%\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt. The history is stored separately for PowerShell and ISE. 

I am using windows 10 and powerShell version is 5, I am able to go to this text file and copied the required commands for my work.  


Posted in PowerShell

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Follow me on Twitter
%d bloggers like this: