SynopsisHide an application window that is open on the desktop of the local computer.
- Hide-Window [-Window]
DescriptionThe 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.
- Window Hide the window associated with this AppWindow object. AppWindow objects are generated using the Get-Window cmdlet.
InputsHide-Window must be used in conjunction with the Get-Window cmdlet and accepts the output of Get-Window as an input object.
OutputsHide-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.
NotesThere are no notes associated with the Hide-Window cmdlet
Example 1Hide-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 2This command will hide any windows with the top title "Untitled - Notepad":
C:\PS>Get-Window -Title "Untitled - Notepad" | Hide-Window
Example 3Some 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