PowerTip: Display Titles of Windows

Doctor Scripto

Summary: Boe Prox shows how to use Windows PowerShell to find the titles of windows.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find the titles of windows?

Hey, Scripting Guy! Answer Use Get-Process and display the title of the processes for windows by looking at
           the MainWindowTitle property, for example:

Get-Process | Where {

    $_.MainWindowTitle

} |

Select-Object ProcessName, MainWindowTitle

 

ProcessName          MainWindowTitle                                             

———–                     —————                                             

ApplicationFrameHost People                                                      

chrome               Browse by Tags – Hey, Scripting Guy! Blog – Site Home – Te…

mstsc                Remote Desktop Connection                                   

notepad              Untitled – Notepad                                          

PeopleApp            People                                                      

powershell           [x64] | BOE-PC\boepr on BOE-PC | PowerShell GC Memory: 25….

powershell_ise       Windows PowerShell ISE                                      

SnagitEditor         Snagit Editor – [Dec 20, 2015 4:55:14 PM]                   

WinStore.Mobile      Store                                                       

WINWORD              Manage Window Placement using Pinvoke.docx [Compatibility …

1 comment

Discussion is closed. Login to edit/delete existing comments.

  • Edwin 0

    ok so im trying to use this code here
    #====================================
    $XN = Get-Process -Name “xnview” | Where-Object {$_.mainWindowTitle} | Select-Object MainWindowTitle
    write-host [$XN]
    #====================================
    to show the window name but it outputs
    #====================================
    [@{MainWindowTitle=Desired Window}]
    #====================================
    my question is is there a way to get it to display only the part after the = so it looks like
    #====================================
    [Desired Window]
    #====================================
    any help would be appreciated

Feedback usabilla icon