Skip to main content

Powershell: Get-History

Illustrated: HISTORY

Get-History - Gets a list of the commands entered during the current session.

Alias: history, h, or ghy.

C:\Users\<USERNAME>\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt

h : Get list of commands entered in current session
r 12 : Run command with Id 12 in current history list
ihy 12 : Run command with Id 12 in current history list
Get-History
history

or simply type 'h' instead of 'history'

h

List the command with id 1

h 1

Add '-count n' or '-c n' to list the last n run command

h -c 1

Run command with id 5 in the history list

ihy 5

Related commands

Linux command: history

Popular posts from this blog

Powershell: Enable Firewall Log

We sometimes need to enable Windows firewall's log to troubleshoot. Here is how.

Powershell: head and tail command

Use head or tail to skim the first or last 5 lines.

[Microsoft Outlook]: Set .pst and .ost files location with ForcePSTPath Registry Key

Set .pst and .ost files location with ForcePSTPath Registry Key The ForcePSTPath registry key is supported by Microsoft Outlook 2003 and later. In Microsoft Outlook 2003 and 2007, it applies to new profiles only. Microsoft Outlook 2013 and Outlook 2016 it applies to new accounts created in a profile. Microsoft Outlook 2013 saves .pst in   %userprofile%\Documents\Outlook Files folder by default. We can change that default setting by adding a new string registry key called ForcePSTPath and set the value to the folder that we want to save those files. Set Microsoft Outlook 2013 always save new .pst and .ost files to D:\Data\Mail folder OST file reached the maximum size The OST File Has Reached The Maximum Size