Runs commands from the session history
Syntax Invoke-History [[-id] string] [-whatIf] [-confirm] [CommonParameters] Key -id The ID number, or the first few characters of a command in the session history. -whatIf Describe what would happen if you executed the command without actually executing the command. -confirm Prompt for confirmation before executing the command.
Standard Aliases for Invoke-History: r, ihy
To find the ID number of a command, use Get-History.
You can pipeline commands from Get-History directly to Invoke-History.
Run the last (most recent) command:
PS C:\> r
Run the most recent get- command in the session history:
PS C:\> Invoke-History get-
Run commands 5 - 15 and 17: (separate multiple IDs with commas)
PS C:\> Invoke-History (5..15), 17
“The fall of the Berlin Wall makes for nice pictures. But it all started in the shipyards” ~ Lech Walesa
Add-History - Add entries to the session history.
Get-History - Get a listing of the session history.
Equivalent bash command: history - Command Line history.