Updates from: 06/12/2021 03:19:10
Service Microsoft Docs article Related commit history on GitHub Change details
Microsoft.PowerShell.Management Start Process (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Management/Start-Process.md
--- external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
-keywords: powershell,cmdlet
Locale: en-US Module Name: Microsoft.PowerShell.Management Previously updated : 08/03/2020 Last updated : 06/11/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/start-process?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Start-Process
Start-Process -FilePath "$env:comspec" -ArgumentList "/c","dir","`"%systemdrive%
Specifies parameters or parameter values to use when this cmdlet starts the process. Arguments can be accepted as a single string with the arguments separated by spaces, or as an array of strings
-separated by commas.
+separated by commas. The cmdlet joins the array into a single string with each element of the array
+separated by a single space.
-If parameters or parameter values contain a space, they need to be surrounded with escaped double
-quotes. For more information, see [about_Quoting_Rules](../Microsoft.PowerShell.Core/About/about_Quoting_Rules.md).
+The outer quotes of the PowerShell strings are not included when the **ArgumentList** values are
+passed to the new process. If parameters or parameter values contain a space or quotes, they need to
+be surrounded with escaped double quotes. For more information, see
+[about_Quoting_Rules](../Microsoft.PowerShell.Core/About/about_Quoting_Rules.md).
```yaml Type: System.String[]
parameter. Otherwise, this cmdlet does not return any output.
## NOTES
+- When using the **Wait** parameter, `Start-Process` waits for the process tree (the process and all
+ its descendants) to exit before returning control. This is different than the behavior of the
+ `Wait-Process` cmdlet, which only waits for the specified processes to exit.
+ - This cmdlet is implemented by using the **Start** method of the **System.Diagnostics.Process** class. For more information about this method, see [Process.Start Method](/dotnet/api/system.diagnostics.process.start#overloads).
Microsoft.PowerShell.Management Wait Process (5.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/5.1/Microsoft.PowerShell.Management/Wait-Process.md
--- external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
-keywords: powershell,cmdlet
Locale: en-US Module Name: Microsoft.PowerShell.Management Previously updated : 06/09/2017 Last updated : 06/11/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/wait-process?view=powershell-5.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Wait-Process
This cmdlet does not generate any output.
## NOTES
-This cmdlet uses the **WaitForExit** method of the **System.Diagnostics.Process** class.
+- This cmdlet uses the **WaitForExit** method of the **System.Diagnostics.Process** class.
+
+- Unlike `Start-Process -Wait`, `Wait-Process` only waits for the processes identified.
+ `Start-Process -Wait` waits for the process tree (the process and all its descendants) to exit
+ before returning control.
## RELATED LINKS
Microsoft.PowerShell.Management Start Process (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Management/Start-Process.md
--- external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
-keywords: powershell,cmdlet
Locale: en-US Module Name: Microsoft.PowerShell.Management Previously updated : 11/11/2020 Last updated : 06/11/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/start-process?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Start-Process
detached process. For more information, see the man page for
Specifies parameters or parameter values to use when this cmdlet starts the process. Arguments can be accepted as a single string with the arguments separated by spaces, or as an array of strings
-separated by commas.
+separated by commas. The cmdlet joins the array into a single string with each element of the array
+separated by a single space.
-If parameters or parameter values contain a space, they need to be surrounded with escaped double
-quotes. For more information, see [about_Quoting_Rules](../Microsoft.PowerShell.Core/About/about_Quoting_Rules.md).
+The outer quotes of the PowerShell strings are not included when the **ArgumentList** values are
+passed to the new process. If parameters or parameter values contain a space or quotes, they need to
+be surrounded with escaped double quotes. For more information, see
+[about_Quoting_Rules](../Microsoft.PowerShell.Core/About/about_Quoting_Rules.md).
```yaml Type: System.String[]
parameter. Otherwise, this cmdlet does not return any output.
## NOTES
+- When using the **Wait** parameter, `Start-Process` waits for the process tree (the process and all
+ its descendants) to exit before returning control. This is different than the behavior of the
+ `Wait-Process` cmdlet, which only waits for the specified processes to exit.
+ - This cmdlet is implemented by using the **Start** method of the **System.Diagnostics.Process** class. For more information about this method, see [Process.Start Method](/dotnet/api/system.diagnostics.process.start#overloads).
Microsoft.PowerShell.Management Wait Process (7.0) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.0/Microsoft.PowerShell.Management/Wait-Process.md
--- external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
-keywords: powershell,cmdlet
Locale: en-US Module Name: Microsoft.PowerShell.Management Previously updated : 06/09/2017 Last updated : 06/11/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/wait-process?view=powershell-7&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Wait-Process
Wait-Process [[-Timeout] <Int32>] -InputObject <Process[]> [<CommonParameters>]
## DESCRIPTION
-The **Wait-Process** cmdlet waits for one or more running processes to be stopped before accepting input.
-In the 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**.
+The `Wait-Process` cmdlet waits for one or more running processes to be stopped before accepting
+input. In the 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.
+`Wait-Process` works only on processes running on the local computer.
## EXAMPLES ### Example 1: Stop a process and wait
-```
-PS C:\> $nid = (Get-Process notepad).id
-PS C:\> Stop-Process -Id $nid
-PS C:\> Wait-Process -Id $nid
-```
-
-This example stops the Notepad process and then waits for the process to be stopped before it continues with the next command.
-
-The first command uses the **Get-Process** cmdlet to get the ID of the Notepad process.
-It stores the ID in the $nid variable.
+This example stops the **Notepad** process and then waits for the process to be stopped before it
+continues with the next command.
-The second command uses the Stop-Process cmdlet to stop the process with the ID stored in $nid.
+```powershell
+$nid = (Get-Process notepad).id
+Stop-Process -Id $nid
+Wait-Process -Id $nid
+```
-The third command uses **Wait-Process** to wait until the Notepad process is stopped.
-It uses the *Id* parameter of **Wait-Process** to identify the process.
+The `Get-Process` cmdlet gets the process ID of the **Notepad** process and stores it in the `$nid`
+variable. `Stop-Process` stops the process with the ID stored in `$nid`. `Wait-Process` waits until
+the **Notepad** process is stopped.
### Example 2: Specifying a process
-```
-PS C:\> $p = Get-Process notepad
-PS C:\> Wait-Process -Id $p.id
-PS C:\> Wait-Process -Name "notepad"
-PS C:\> Wait-Process -InputObject $p
-```
+This example shows three different methods of specifying a process to `Wait-Process`. The first
+command gets the Notepad process and stores 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 show three different methods of specifying a process to **Wait-Process**.
-The first command gets the Notepad process and stores 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.
+```powershell
+$p = Get-Process notepad
+Wait-Process -Id $p.id
+Wait-Process -Name "notepad"
+Wait-Process -InputObject $p
+```
These commands have the same results and can be used interchangeably. ### Example 3: Wait for processes for a specified time
-```
-PS C:\> Wait-Process -Name outlook, winword -Timeout 30
-```
+In this example, `Wait-Process` 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.
-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.
+```powershell
+Wait-Process -Name outlook, winword -Timeout 30
+```
## PARAMETERS ### -Id
-Specifies the process IDs of the processes.
-To specify multiple IDs, use commas to separate the IDs.
+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`. ```yaml
Accept wildcard characters: False
### -InputObject
-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 the Get-Process cmdlet.
+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 the `Get-Process`
+cmdlet.
```yaml Type: System.Diagnostics.Process[]
Accept wildcard characters: False
### -Name
-Specifies the process names of the processes.
-To specify multiple names, use commas to separate the names.
-Wildcard characters are not supported.
+Specifies the process names of the processes. To specify multiple names, use commas to separate the
+names. Wildcard characters are not supported.
```yaml Type: System.String[]
Accept wildcard characters: False
### -Timeout Specifies the maximum time, in seconds, that this cmdlet 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.
-By default, there is no time-out.
+When this interval expires, the command displays a non-terminating error that lists the processes
+that are still running, and ends the wait. By default, there is no time-out.
```yaml Type: System.Int32
Accept wildcard characters: False
### CommonParameters
-This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
+-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
+-WarningAction, and -WarningVariable. For more information, see
+[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
This cmdlet does not generate any output.
## NOTES
-The cmdlet is only supported on Windows platforms.
+- The cmdlet is only supported on Windows platforms.
+
+- This cmdlet uses the **WaitForExit** method of the **System.Diagnostics.Process** class.
-This cmdlet uses the **WaitForExit** method of the **System.Diagnostics.Process** class.
+- Unlike `Start-Process -Wait`, `Wait-Process` only waits for the processes identified.
+ `Start-Process -Wait` waits for the process tree (the process and all its descendants) to exit
+ before returning control.
## RELATED LINKS
Microsoft.PowerShell.Management Start Process (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Management/Start-Process.md
--- external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
-keywords: powershell,cmdlet
Locale: en-US Module Name: Microsoft.PowerShell.Management Previously updated : 11/11/2020 Last updated : 06/11/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Start-Process
detached process. For more information, see the man page for
Specifies parameters or parameter values to use when this cmdlet starts the process. Arguments can be accepted as a single string with the arguments separated by spaces, or as an array of strings
-separated by commas.
+separated by commas. The cmdlet joins the array into a single string with each element of the array
+separated by a single space.
-If parameters or parameter values contain a space, they need to be surrounded with escaped double
-quotes. For more information, see [about_Quoting_Rules](../Microsoft.PowerShell.Core/About/about_Quoting_Rules.md).
+The outer quotes of the PowerShell strings are not included when the **ArgumentList** values are
+passed to the new process. If parameters or parameter values contain a space or quotes, they need to
+be surrounded with escaped double quotes. For more information, see
+[about_Quoting_Rules](../Microsoft.PowerShell.Core/About/about_Quoting_Rules.md).
```yaml Type: System.String[]
parameter. Otherwise, this cmdlet does not return any output.
## NOTES
+- When using the **Wait** parameter, `Start-Process` waits for the process tree (the process and all
+ its descendants) to exit before returning control. This is different than the behavior of the
+ `Wait-Process` cmdlet, which only waits for the specified processes to exit.
+ - This cmdlet is implemented by using the **Start** method of the **System.Diagnostics.Process** class. For more information about this method, see [Process.Start Method](/dotnet/api/system.diagnostics.process.start#overloads).
Microsoft.PowerShell.Management Wait Process (7.1) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.1/Microsoft.PowerShell.Management/Wait-Process.md
--- external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml
-keywords: powershell,cmdlet
Locale: en-US Module Name: Microsoft.PowerShell.Management Previously updated : 06/09/2017 Last updated : 06/11/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/wait-process?view=powershell-7.1&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Wait-Process
Wait-Process [[-Timeout] <Int32>] -InputObject <Process[]> [<CommonParameters>]
## DESCRIPTION
-The **Wait-Process** cmdlet waits for one or more running processes to be stopped before accepting input.
-In the 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**.
+The `Wait-Process` cmdlet waits for one or more running processes to be stopped before accepting
+input. In the 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.
+`Wait-Process` works only on processes running on the local computer.
## EXAMPLES ### Example 1: Stop a process and wait
-```
-PS C:\> $nid = (Get-Process notepad).id
-PS C:\> Stop-Process -Id $nid
-PS C:\> Wait-Process -Id $nid
-```
-
-This example stops the Notepad process and then waits for the process to be stopped before it continues with the next command.
-
-The first command uses the **Get-Process** cmdlet to get the ID of the Notepad process.
-It stores the ID in the $nid variable.
+This example stops the **Notepad** process and then waits for the process to be stopped before it
+continues with the next command.
-The second command uses the Stop-Process cmdlet to stop the process with the ID stored in $nid.
+```powershell
+$nid = (Get-Process notepad).id
+Stop-Process -Id $nid
+Wait-Process -Id $nid
+```
-The third command uses **Wait-Process** to wait until the Notepad process is stopped.
-It uses the *Id* parameter of **Wait-Process** to identify the process.
+The `Get-Process` cmdlet gets the process ID of the **Notepad** process and stores it in the `$nid`
+variable. `Stop-Process` stops the process with the ID stored in `$nid`. `Wait-Process` waits until
+the **Notepad** process is stopped.
### Example 2: Specifying a process
-```
-PS C:\> $p = Get-Process notepad
-PS C:\> Wait-Process -Id $p.id
-PS C:\> Wait-Process -Name "notepad"
-PS C:\> Wait-Process -InputObject $p
-```
+This example shows three different methods of specifying a process to `Wait-Process`. The first
+command gets the Notepad process and stores 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 show three different methods of specifying a process to **Wait-Process**.
-The first command gets the Notepad process and stores 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.
+```powershell
+$p = Get-Process notepad
+Wait-Process -Id $p.id
+Wait-Process -Name "notepad"
+Wait-Process -InputObject $p
+```
These commands have the same results and can be used interchangeably. ### Example 3: Wait for processes for a specified time
-```
-PS C:\> Wait-Process -Name outlook, winword -Timeout 30
-```
+In this example, `Wait-Process` 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.
-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.
+```powershell
+Wait-Process -Name outlook, winword -Timeout 30
+```
## PARAMETERS ### -Id
-Specifies the process IDs of the processes.
-To specify multiple IDs, use commas to separate the IDs.
+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`. ```yaml
Accept wildcard characters: False
### -InputObject
-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 the Get-Process cmdlet.
+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 the `Get-Process`
+cmdlet.
```yaml Type: System.Diagnostics.Process[]
Accept wildcard characters: False
### -Name
-Specifies the process names of the processes.
-To specify multiple names, use commas to separate the names.
-Wildcard characters are not supported.
+Specifies the process names of the processes. To specify multiple names, use commas to separate the
+names. Wildcard characters are not supported.
```yaml Type: System.String[]
Accept wildcard characters: False
### -Timeout Specifies the maximum time, in seconds, that this cmdlet 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.
-By default, there is no time-out.
+When this interval expires, the command displays a non-terminating error that lists the processes
+that are still running, and ends the wait. By default, there is no time-out.
```yaml Type: System.Int32
Accept wildcard characters: False
### CommonParameters
-This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
+-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
+-WarningAction, and -WarningVariable. For more information, see
+[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
This cmdlet does not generate any output.
## NOTES
-The cmdlet is only supported on Windows platforms.
+- The cmdlet is only supported on Windows platforms.
+
+- This cmdlet uses the **WaitForExit** method of the **System.Diagnostics.Process** class.
-This cmdlet uses the **WaitForExit** method of the **System.Diagnostics.Process** class.
+- Unlike `Start-Process -Wait`, `Wait-Process` only waits for the processes identified.
+ `Start-Process -Wait` waits for the process tree (the process and all its descendants) to exit
+ before returning control.
## RELATED LINKS
Microsoft.PowerShell.Management Start Process (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Management/Start-Process.md
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management Previously updated : 11/11/2020 Last updated : 06/11/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Start-Process
detached process. For more information, see the man page for
Specifies parameters or parameter values to use when this cmdlet starts the process. Arguments can be accepted as a single string with the arguments separated by spaces, or as an array of strings
-separated by commas.
+separated by commas. The cmdlet joins the array into a single string with each element of the array
+separated by a single space.
-If parameters or parameter values contain a space, they need to be surrounded with escaped double
-quotes. For more information, see [about_Quoting_Rules](../Microsoft.PowerShell.Core/About/about_Quoting_Rules.md).
+The outer quotes of the PowerShell strings are not included when the **ArgumentList** values are
+passed to the new process. If parameters or parameter values contain a space or quotes, they need to
+be surrounded with escaped double quotes. For more information, see
+[about_Quoting_Rules](../Microsoft.PowerShell.Core/About/about_Quoting_Rules.md).
```yaml Type: System.String[]
parameter. Otherwise, this cmdlet does not return any output.
## NOTES
+- When using the **Wait** parameter, `Start-Process` waits for the process tree (the process and all
+ its descendants) to exit before returning control. This is different than the behavior of the
+ `Wait-Process` cmdlet, which only waits for the specified processes to exit.
+ - This cmdlet is implemented by using the **Start** method of the **System.Diagnostics.Process** class. For more information about this method, see [Process.Start Method](/dotnet/api/system.diagnostics.process.start#overloads).
Microsoft.PowerShell.Management Wait Process (7.2) https://github.com/MicrosoftDocs/PowerShell-Docs/commits/staging/reference/7.2/Microsoft.PowerShell.Management/Wait-Process.md
external help file: Microsoft.PowerShell.Commands.Management.dll-Help.xml Locale: en-US Module Name: Microsoft.PowerShell.Management Previously updated : 06/09/2017 Last updated : 06/11/2021 online version: https://docs.microsoft.com/powershell/module/microsoft.powershell.management/wait-process?view=powershell-7.2&WT.mc_id=ps-gethelp schema: 2.0.0 Title: Wait-Process
Wait-Process [[-Timeout] <Int32>] -InputObject <Process[]> [<CommonParameters>]
## DESCRIPTION
-The **Wait-Process** cmdlet waits for one or more running processes to be stopped before accepting input.
-In the 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**.
+The `Wait-Process` cmdlet waits for one or more running processes to be stopped before accepting
+input. In the 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.
+`Wait-Process` works only on processes running on the local computer.
## EXAMPLES ### Example 1: Stop a process and wait
-```
-PS C:\> $nid = (Get-Process notepad).id
-PS C:\> Stop-Process -Id $nid
-PS C:\> Wait-Process -Id $nid
-```
-
-This example stops the Notepad process and then waits for the process to be stopped before it continues with the next command.
-
-The first command uses the **Get-Process** cmdlet to get the ID of the Notepad process.
-It stores the ID in the $nid variable.
+This example stops the **Notepad** process and then waits for the process to be stopped before it
+continues with the next command.
-The second command uses the Stop-Process cmdlet to stop the process with the ID stored in $nid.
+```powershell
+$nid = (Get-Process notepad).id
+Stop-Process -Id $nid
+Wait-Process -Id $nid
+```
-The third command uses **Wait-Process** to wait until the Notepad process is stopped.
-It uses the *Id* parameter of **Wait-Process** to identify the process.
+The `Get-Process` cmdlet gets the process ID of the **Notepad** process and stores it in the `$nid`
+variable. `Stop-Process` stops the process with the ID stored in `$nid`. `Wait-Process` waits until
+the **Notepad** process is stopped.
### Example 2: Specifying a process
-```
-PS C:\> $p = Get-Process notepad
-PS C:\> Wait-Process -Id $p.id
-PS C:\> Wait-Process -Name "notepad"
-PS C:\> Wait-Process -InputObject $p
-```
+This example shows three different methods of specifying a process to `Wait-Process`. The first
+command gets the Notepad process and stores 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 show three different methods of specifying a process to **Wait-Process**.
-The first command gets the Notepad process and stores 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.
+```powershell
+$p = Get-Process notepad
+Wait-Process -Id $p.id
+Wait-Process -Name "notepad"
+Wait-Process -InputObject $p
+```
These commands have the same results and can be used interchangeably. ### Example 3: Wait for processes for a specified time
-```
-PS C:\> Wait-Process -Name outlook, winword -Timeout 30
-```
+In this example, `Wait-Process` 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.
-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.
+```powershell
+Wait-Process -Name outlook, winword -Timeout 30
+```
## PARAMETERS ### -Id
-Specifies the process IDs of the processes.
-To specify multiple IDs, use commas to separate the IDs.
+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`. ```yaml
Accept wildcard characters: False
### -InputObject
-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 the Get-Process cmdlet.
+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 the `Get-Process`
+cmdlet.
```yaml Type: System.Diagnostics.Process[]
Accept wildcard characters: False
### -Name
-Specifies the process names of the processes.
-To specify multiple names, use commas to separate the names.
-Wildcard characters are not supported.
+Specifies the process names of the processes. To specify multiple names, use commas to separate the
+names. Wildcard characters are not supported.
```yaml Type: System.String[]
Accept wildcard characters: False
### -Timeout Specifies the maximum time, in seconds, that this cmdlet 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.
-By default, there is no time-out.
+When this interval expires, the command displays a non-terminating error that lists the processes
+that are still running, and ends the wait. By default, there is no time-out.
```yaml Type: System.Int32
Accept wildcard characters: False
### CommonParameters
-This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
+This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
+-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose,
+-WarningAction, and -WarningVariable. For more information, see
+[about_CommonParameters](https://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
This cmdlet does not generate any output.
## NOTES
-The cmdlet is only supported on Windows platforms.
+- The cmdlet is only supported on Windows platforms.
+
+- This cmdlet uses the **WaitForExit** method of the **System.Diagnostics.Process** class.
-This cmdlet uses the **WaitForExit** method of the **System.Diagnostics.Process** class.
+- Unlike `Start-Process -Wait`, `Wait-Process` only waits for the processes identified.
+ `Start-Process -Wait` waits for the process tree (the process and all its descendants) to exit
+ before returning control.
## RELATED LINKS