This cmdlet is part of the Vexasoft Cmdlet Library. You can download it now or click here to find out more.

Set-WindowFocus

Synopsis

Give focus to the specified window that is open on the desktop of the local computer.

Syntax

  • Set-WindowFocus [-Window]

Description

The Set-WindowFocus cmdlet is used to give focus to an application window that is open on the desktop of the local computer.

Set-WindowFocus requires that you use the Get-Window cmdlet to identify the target application window. The target window will then be brought to the front and activated on the user's desktop.

Parameters

  • Window The target application window. AppWindow objects are generated using the Get-Window cmdlet.

Inputs

Set-WindowFocus must be used in conjunction with the Get-Window cmdlet and accepts the output of Get-Window as an input object.

Outputs

Set-WindowFocus does not output any PowerShell objects.

Notes

There are no notes associated with the Set-WindowFocus cmdlet.

Example 1

Set-Window focus must be used in conjunction with the Get-Window cmdlet.

This command will set Internet Explorer to the front of all other windows:

C:\PS>Get-Window iexplore | Set-WindowFocus