user3801937
user3801937

Reputation: 101

How to output a list of window titles in a console window?

Is there a way to output a list of running window titles to the command window?

I know that it's possible to filter based on window title using tasklist /FI. But is it possible to display a column of all window titles?

TaskList will provide the image name, but I'm looking for the name as it appears in the task manager under the applications tab.

Upvotes: 10

Views: 22954

Answers (3)

ZEE
ZEE

Reputation: 3193

Create a batch called Windows-Open.cmd
and put the follwing command inside:

TASKLIST /v /fo list |find /i "window title" |find /v "N/A"

There are a few refinements we can yet do... but for me its enough,,, simple,,, lean &% mean...

  • you can easy derive from there, for example: Windows-noTitle.cmd etc. etc.

Stay good...

Upvotes: 8

Mofi
Mofi

Reputation: 49126

The command posted by Ir Relevant is good. But it must be adapted according to version and language of Windows.

For example the command for execution in a command prompt window on a German Windows XP is:

for /f "tokens=2,*" %a in ('tasklist.exe /fo list /v ^| find.exe "Fenstertitel:"') do @if not "%a %b"=="Nicht verfügbar" echo %a %b

And for usage in a batch file each % must be duplicated:

@echo off
for /f "tokens=2,*" %%a in ('tasklist.exe /fo list /v ^| find.exe "Fenstertitel:"') do @if not "%%a %%b"=="Nicht verfügbar" echo %%a %%b

Attention!
German umlaut ü must be an OEM encoded ü with decimal code value 129 in the batch file instead of an ANSI encoded ü with decimal code value 252.

Upvotes: 1

Ir Relevant
Ir Relevant

Reputation: 1033

Do you mean something like this?

for /f "tokens=3,*" %a in ('tasklist /fo list /v ^| find "Window Title"') do @if not "%a"=="N/A" echo %a %b

Upvotes: 5

Related Questions