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

Hide-Window

Synopsis

Hide an application window that is open on the desktop of the local computer.

Syntax

  • Hide-Window [-Window]

Description

The Hide-Window cmdlet is used to hide application windows that are open on the desktop of the local computer.

Hide-Window requires that you use the Get-Window cmdlet to identify the target application window. Details of any windows hidden by this cmdlet are stored in the $HiddenWindows variable. Hidden windows can be restored using the Show-Window cmdlet and $HiddenWindows.

Parameters

  • Window Hide the window associated with this AppWindow object. AppWindow objects are generated using the Get-Window cmdlet.

Inputs

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

Outputs

Hide-Window returns a HiddenWindow object for each window that is hidden. A copy of these objects is also held in the $HiddenWindow variable. The HiddenWindow object is required to bring back a hidden window using the Show-Window cmdlet.

Notes

There are no notes associated with the Hide-Window cmdlet

Example 1

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

This command hides any windows associated with the Outlook application on the local desktop. Details of the hidden windows are stored in the $HiddenWindows variable:

C:\PS>Get-Window outlook | Hide-Window

Example 2

This command will hide any windows with the top title "Untitled - Notepad":

C:\PS>Get-Window -Title "Untitled - Notepad" | Hide-Window

Example 3

Some care must be taken when using the Hide-Window cmdlet. In this command all windows currently visible to the user will be hidden, including the PowerShell window itself. You will then be unable to access the $HiddenWindows variable and will not be able to recover the session.

C:\PS>Get-Window | Hide-Window