Forrest logo
back to the Get-History tool

get-history:tldr:b2601

get-history: Display the commands history list with ID.
$ Get-History
try on your machine

The "Get-History" command is used in PowerShell to retrieve a list of commands that were previously executed in the current session. It displays the history of commands and their execution order.

When you run the "Get-History" command, it returns an object that contains information about each command, such as its ID, the time it was executed, and the command-line text itself. The history is stored in memory for the duration of the session, and it can be accessed using this command.

The output of the "Get-History" command typically includes columns like "Id", "CommandLine", "ExecutionStatus", "StartExecutionTime", "EndExecutionTime", and more. This information can be useful for reviewing the command history, repeating or modifying previously used commands, or troubleshooting.

It's worth noting that the command history in PowerShell is limited to the current session, so if you close and reopen PowerShell, the history will be reset. Additionally, the number of commands stored in the history can be limited based on the system's configuration.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the Get-History tool