Waits for the processes to be stopped before accepting more input. (Wait-Process)

   

# NAME
Wait-Process

# SYNOPSIS
Waits for the processes to be stopped before accepting more input.

# SYNTAX
Wait-Process [-Id] <Int32[]> [[-Timeout] <int>] [<CommonParameters>]

Wait-Process -InputObject <Process[]> [[-Timeout] <int>] [<CommonParameters>]

Wait-Process [-Name] <string[]> [[-Timeout] <int>] [<CommonParameters>]

# DESCRIPTION
The Wait-Process cmdlet waits for one or more running processes to be stopped before accepting input. In the Windows PowerShell console, this cmdlet suppresses the command prompt until the processes are stopped. You can specify a process by process name or process ID (PID), or pipe a process object to Wait-Process.

Wait-Process works only on processes running on the local computer.

# PARAMETERS
-Id <Int32[]>
Specifies the process IDs of the processes. To specify multiple IDs, use commas to separate the IDs. To find the PID of a process, type "get-process". The parameter name ("Id") is optional.

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

-InputObject <Process[]>
Specifies the processes by submitting process objects. Enter a variable that contains the process objects, or type a command or expression that gets the process objects, such as a Get-Process command.

Required? true
Position? named
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false

-Name <string[]>
Specifies the process names of the processes. To specify multiple names, use commas to separate the names.

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

-Timeout <int>
Determines the maximum time, in seconds, that Wait-Process waits for the specified processes to stop. When this interval expires, the command displays a non-terminating error that lists the processes that are still running, and ends the wait.

Required? false
Position? 2
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
System.Diagnostics.Process
You can pipe a process object to Wait-Process.

# OUTPUTS
None
This cmdlet does not generate any output.

# NOTES

This cmdlet uses the WaitForExit method of the System.Diagnostics.Process class. For more information about this method, see the Microsoft .NET Framework SDK.

# EXAMPLE 1

C:\PS>$nid = (get-process notepad).id

C:\PS> stop-process -id $nid

C:\PS> wait-process -id $nid

# Description
-----------
These commands stop the Notepad process and then wait for the process to be stopped before proceeding with the next command.

The first command uses the Get-Process cmdlet to get the ID of the Notepad process. It saves it in the $nid variable.

The second command uses the Stop-Process cmdlet to stop the process with the ID saved in $nid.

The third command uses the Wait-Process cmdlet to wait until the Notepad process is stopped. It uses the ID parameter of Wait-Process to identify the process.

# EXAMPLE 2

C:\PS>$p = get-process notepad

C:\PS> wait-process -id $p.id

C:\PS> wait-process -name notepad

C:\PS> wait-process -inputobject $p

# Description
-----------
These commands show three different methods of specifying a process to the Wait-Process cmdlet. The first command gets the Notepad process and saves it in the $p variable.

The second command uses the ID parameter, the third command uses the Name parameter, and the fourth command uses the InputObject parameter.

These commands have the same results and can be used interchangeably.

# EXAMPLE 3

C:\PS>wait-process -name outlook, winword -timeout 30

# Description
-----------
This command waits 30 seconds for the Outlook and Winword processes to stop. If both processes are not stopped, the cmdlet displays a non-terminating error and the command prompt.

RELATED LINKS
Online version: http://go.microsoft.com/fwlink/?LinkID=135277
Get-Process
Start-Process
Stop-Process
Wait-Process
Debug-Process

C:\Windows>powershell get-help Debug-Process -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 7 Starter, Home (Basic Premium), Professional und Ultimate!

... facebook.de
0.109
8 Lösungen, um den Task-Manager in Windows 8.1, 8  und 10 zu öffnen, bzw. starten!  / Wie kann ich einen weiteren Registrierungseditor starten?  / Wie kann ich MultiClipBoardSlots deinstallieren!  / Was sind Windows Shell extensions (Erweiterungen)?  / How to scan to pdf in Windows 7?  / Windows-7- 30 Tage sind abgelaufen, welche Nachteile habe ich?  / Welche Größen-Ordnungen von Byte sind vorhanden?  / Die Windows Tastenkombination fürs Abmelden schnell und direkt!  / How to select/add users for Windows 8 / 10 Remote Desktop connections (allow, disallow, access authorization)?  / Customize the pagefile.sys in Windows 10 (paging file)?  / Update Windows 8 to Windows 8.1 for free (upgrade)!  / Wozu brauche ich Microsoft Virtual PC? Ist das was für mich?  /