PowerShell – Where is the command history stored?

Every command you type into a PowerShell console is recorded in a single file in the current user’s app data directory. This is useful when you need to refer back to a command you entered but it can be security risk if you’ve entered sensitive data in plain text (like passwords or user data). In those cases try to use secure objects like PSCredential for usernames and passwords.

You can find the file here:


If you want to disable saving your commands to this file you can add the following to either your PowerShell profile.ps1 file to permanently disable it or for just the current console session simply type it in to your console.

Set-PSReadlineOption -HistorySaveStyle SaveNothing

More information available here:


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.