Runs commands from the session history. (Invoke-History)

   

# NAME
Invoke-History

# SYNOPSIS
Runs commands from the session history.

# SYNTAX
Invoke-History [[-Id] <string>] [-Confirm] [-WhatIf] [<CommonParameters>]

# DESCRIPTION
The Invoke-History cmdlet runs commands from the session history. You can pass objects representing the commands from Get-History to Invoke-History, or you can identify commands in the current history by using their ID number. To find the identification number of a command, use Get-History.

# PARAMETERS
-Id <string>
Identifies a command in the history. You can type the ID number of the command or the first few characters of the command.

If you type characters, Invoke-History matches the most recent commands first. If you omit this parameter, Invoke-History runs the last (most recent) command. The parameter name ("id") is optional. To find the ID number of a command, use Get-History.

Required? false
Position? 1
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false

-Confirm [<SwitchParameter>]
Prompts you for confirmation before executing the command.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

-WhatIf [<SwitchParameter>]
Describes what would happen if you executed the command without actually executing the command.

Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false

<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

# INPUTS
None
You cannot pipe input to this cmdlet.

# OUTPUTS
None
Invoke-History does not generate any output, but output might be generated by the commands that Invoke-History runs.

# NOTES

The session history is a list of the commands entered during the session along with the ID. The session history represents the order of execution, the status, and the start and end times of the command. As you enter each command, Windows PowerShell adds it to the history so that you can reuse it. For more information about the session history, see about_History.

You can also refer to Invoke-History by its built-in aliases, "r" and "ihy". For more information, see about_Aliases.

# EXAMPLE 1

C:\PS>invoke-history

# Description
-----------
This command runs the last (most recent) command in the session history. You can abbreviate this command as "r" (think "repeat" or "rerun"), the alias for Invoke-History.

# EXAMPLE 2

C:\PS>invoke-history -id 132

# Description
-----------
This command runs the command in the session history with ID 132. Because the name of the Id parameter is optional, you can abbreviate this command as "Invoke-History 132", "ihy 132", or "r 132".

# EXAMPLE 3

C:\PS>invoke-history get-pr

# Description
-----------
This command runs the most recent Get-Process command in the session history. When you type characters for the Id parameter, Invoke-History runs the first command that it finds that matches the pattern, beginning with the most recent commands. This command uses the ID parameter, but it omits the optional parameter name.

# EXAMPLE 4

C:\PS>invoke-history (16..24), 27

# Description
-----------
This command runs commands 16 through 24 and 27. You can list multiple IDs and ID ranges separated by commas.

# EXAMPLE 5

C:\PS>get-history -id 255 -count 7 | invoke-history

# Description
-----------
This command runs the 7 commands in the history that end with command 255 (typically 249 through 255). It uses the Get-History cmdlet to retrieve the commands. The pipeline operator (|) passes the commands to Invoke-History, which executes them.

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=113344
about_History
Get-History
Add-History
Clear-History

C:\Windows>powershell get-help Add-History -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows-10 / Windows-8.1 & 8 / Windows-7 & Vista / Windows Server 2008-2016
»»»» ColorConsole



 


... Home  
... Impressum
... ColorConsole

... CMD
... Netsh-XP
... Netsh-7
... Netsh-Vista
... Powershell





;-)









Download the Windows 10 Starter, Home (Basic Premium), Professional und Ultimate!

... facebook.de
0.124
How to prevent system shutdown, Standby, Hibernate, Turn Off and Restart on Windows 8.1, 8, 10?  / Windows 7 Download: Starter, Home (Basic Premium), Professional und Win 7 Ultimate!  / Windows 7 calculator desktop shortcut, how to?  / Wie kann ich das Windows 10 Startmenü anpassen?  / Wo finde ich den Download für eine gute Alternative zu Microsofts Office?  / Warum erscheint bei Copy Paste das Auswahlmenü?  / Disable auto start of the speech recognition in Windows 8.1 (turn off)?  / Wo ist der Unterschied zwischen Windows 7 Ultimate x64 zu x86?  / Gibt es Probleme beim Installieren/Abspielen der Audio und Video Codecs in Windows 7?  / Neuinstallation von Vista auf Windows-7 und alte Daten behalten?  / Upgrade auf Windows 7 hängt bei 62 Prozent?  / Wie kann ich unter Windows 7 meinen Kopfhörer anschließen.Ich bekomme keinen Ton auf meinen Kopfhörern?  /