Get-WindowTitle
SYNOPSISโ
Search for an open window title and return details about the window.
SYNTAXโ
SearchWinTitleโ
Get-WindowTitle -WindowTitle <String> [-DisableFunctionLogging] [<CommonParameters>]
GetAllWinTitlesโ
Get-WindowTitle [-GetAllWindowTitles] [-DisableFunctionLogging] [<CommonParameters>]
DESCRIPTIONโ
Search for a window title. If window title searched for returns more than one result, then details for each window will be displayed.
Returns the following properties for each window: WindowTitle, WindowHandle, ParentProcess, ParentProcessMainWindowHandle, ParentProcessId.
Function does not work in SYSTEM context unless launched with "psexec.exe -s -i" to run it as an interactive process under the SYSTEM account.
EXAMPLESโ
EXAMPLE 1โ
Get-WindowTitle -WindowTitle 'Microsoft Word'
Gets details for each window that has the words "Microsoft Word" in the title.
EXAMPLE 2โ
Get-WindowTitle -GetAllWindowTitles
Gets details for all windows with a title.
EXAMPLE 3โ
Get-WindowTitle -GetAllWindowTitles | Where-Object { $_.ParentProcess -eq 'WINWORD' }
Get details for all windows belonging to Microsoft Word process with name "WINWORD".
PARAMETERSโ
-WindowTitleโ
The title of the application window to search for using regex matching.
Type: String
Parameter Sets: SearchWinTitle
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-GetAllWindowTitlesโ
Get titles for all open windows on the system.
Type: SwitchParameter
Parameter Sets: GetAllWinTitles
Aliases:
Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-DisableFunctionLoggingโ
Disables logging messages to the script log file.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
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.