PowerTip: Use PowerShell to Find Title of Foreground Word Document


Summary: Use Windows PowerShell to find the title of the foreground Word document.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find the title of the Word document that is currently in the foreground when 
           I have several documents open?

Hey, Scripting Guy! Answer The Get-Process cmdlet with the MainWindowTitle property will list the title of the Word document.
           This example presents the main window title and the start time of the application:

Get-Process winword | select starttime, MainWindowTitle

Comments (2)

  1. tommymaynard says:

    The MainWindowTitle property has turned out to be quite helpful. At some point in that past, I had a few RDP sessions running at the same time. One of the processes had hung, making it impossible to get to any of the others. I had to use this property
    to filter down which mstsc process to end — something like: Get-Process | where MainWindowTitle -like ‘*server10*’ | Stop-Process. Thanks, Ed!

Skip to main content