comment 0

Tip : Clear PowerShell History in Windows 10

So I was using Power Shell in Windows 10 and realised my command history was being saved across sessions. Clear-History did nothing for me. I found out that I could do either one of these two things (at least)

Run the following command, [Microsoft.PowerShell.PSConsoleReadLine]::ClearHistory()

But the above only clears it for that session and commands come back next session (via the up arrow) Or find the ConsoleHost_history file and clear it

C:\Users\[Your Username]\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline

That permanently deletes the commands across sessions. Also, it occurred to me that I should indicate what version of PowerShell I am working with. The command I used was $PSVersionTable.PSVersion and the result

Major Minor Build Revision
----- ----- ----- --------
5     1     14986 1000

Sharing on the blog because it was not so easy to find this information. Hope this helped you if you came searching and found this.

Leave a Reply

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

You are commenting using your 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