Would you like to learn how to clear the Powershell command history? In this tutorial, we are going to show you how to disable the Powershell command history feature on a computer running Windows.

• Windows 2012 R2
• Windows 2016
• Windows 2019
• Windows 2022
• Windows 10
• Windows 11

Equipment list

Here you can find the list of equipment used to create this tutorial.

This link will also show the software list used to create this tutorial.

Related tutorial - PowerShell

On this page, we offer quick access to a list of tutorials related to PowerShell.

Tutorial Powershell - Clear the command history

Start a Powershell command-line.

Start Powershell

Enter commands to fill the Powershell history file.

Copy to Clipboard

Show the Powershell command history.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Clear the Powershell command history.

Copy to Clipboard

Delete a specific command from the Powershell history.

Copy to Clipboard

Clear the command line buffer.

Copy to Clipboard

There are multiple ways to clear the command line buffer.

Copy to Clipboard

Locate the Powershell history file.

Copy to Clipboard

Delete the Powershell history file.

Copy to Clipboard

Limit the number of commands stored in the Powershell history.

Copy to Clipboard

Disable the up arrow and down arrow functions.

Copy to Clipboard

Congratulations! You are able to delete the Powershell command history.

Tutorial Powershell - Disable the command history

Start a Powershell command-line.

Start Powershell

Create a Powershell profile.

Copy to Clipboard

Edit the Powershell profile.

Copy to Clipboard

Here is the file content.

Copy to Clipboard

Optionally, disable the up arrow and down arrow functions.

Copy to Clipboard

In our example, we configured the profile to clear the Powershell command history at the beginning of the user session.

Your computer must allow Powershell scripts.

Copy to Clipboard

Congratulations! You are able to disable the Powershell command history feature.