27

In Windows 7, is it possible to obtain a list of all open desktop windows from the command line? I know that it's possible to obtain a list of all running processes from the command line, but I want to know if it's possible to obtain a list of open windows as well.

Community
  • 1
  • 1
Anderson Green
  • 30,230
  • 67
  • 195
  • 328
  • [This solution](http://stackoverflow.com/questions/191206/how-to-get-list-of-running-applications-using-powershell-or-vbscript) appears similar, but I'm not sure if it does exactly the same thing. Is obtaining a list of all running Windows applications equivalent to obtaining a list of all open windows? – Anderson Green Mar 19 '13 at 04:06
  • Here's one possible solution: http://stackoverflow.com/questions/18456091/get-a-list-of-all-open-windows-using-autoit – Anderson Green May 07 '14 at 19:50
  • there is a solution: https://stackoverflow.com/questions/25771386/get-all-windows-of-a-process-in-powershe – max630 Sep 20 '18 at 13:27

5 Answers5

9

The "/v" option lists the window names in the last column. As in "tasklist /v". You can also pipe it into another application or find to do filtering.

Mike Newell
  • 91
  • 1
  • 2
6

Use

tasklist /fi "windowtitle eq <Title of window*>"

For example:

tasklist /fi "windowtitle eq Notepad*"
ArtOfWarfare
  • 20,617
  • 19
  • 137
  • 193
user3611868
  • 93
  • 1
  • 2
  • 5
    Now I wonder if it would be feasible to obtain the list of open windows without knowing the title of each window in advance. – Anderson Green May 07 '14 at 19:49
  • 4
    There should be a eq or ne condition in there as well: tasklist /fi "windowtitle eq Notepad*" – Almund Jul 13 '16 at 07:43
  • @Almund - You should have edited the answer to fix that. I've taken care of it. – ArtOfWarfare Feb 17 '17 at 16:02
  • 2
    I don't need active processes, I need active windows. One process can open few windows. Also this command doesn't work even if only one window is created. – vitaliydev Sep 19 '17 at 13:40
3

WinLister from NirSoft list all windows active on a machine as well as associated information (title, path, handle, class, position, process ID, thread ID, etc.). It has a GUI interface rather than command-line.

EBlake
  • 735
  • 7
  • 14
2

if you just use the following command, it will list all active processes

tasklist

Or filtering by session name would restrict a bit more to get processes started by console:

tasklist /FI "SESSIONNAME eq Console"

1

Use powershell. The command is: Get-Process

You can try this:

##Method 1: (Gives you all the processes)
Get-Process

## Method 2: Detailed Info On a specific named Process
$ProcessTerm="chrome"
#Run This:
$FindProcess = Get-Process | Where-Object {$_.MainWindowTitle -like "*$processterm*"}
Get-Process -ID $FindProcess.ID | Select-Object *

# FindProcess.ID will give you the ID of the above process

#Method 3: (if you know the process ID)
$ProcessID = "9068"
$FindProcess = Get-Process | Where-Object {$_.id -eq "$ProcessID"}
Get-Process -ID $FindProcess.Id | Select-Object *
Inventologist
  • 169
  • 1
  • 4