LISTWINDOWS — List windows, using a
user-defined format string.
Syntax:
LISTWINDOWS /C:class /E:prog /F:"fmt" /I /L:n /O:flags /P /R /T:title /V /W:win
/C:class | filter top-level windows by class name (supports wildcards) |
/E:prog | list windows created by the specified program (name or PID) |
/F:"fmt" | format string |
/I | invisible windows only |
/L:n | line length |
/O:flags | sort windows |
/P | page output |
/R | list child windows recursively |
/T:class | filter top-level windows by title (supports wildcards) |
/V | visible windows only |
/W:win | list child windows of the specified window (title or handle) |
With /E:prog,
this command lists all top-level windows created by the specified program. With
/W:win, this command lists all child windows
of the specified window. With neither /E: nor /W:, it lists
all top-level windows.
If no /F:"fmt" is
given, the default format string is
"$08h: $v $-25c \u201c$t\u201d"
to list each window’s handle, visibility, class name, and title.
/E:prog lists
windows created by a specific program. The prog may be
either a process ID or a filename. If it’s a process ID, you can enter it in
decimal, or hexadecimal with a leading 0x. Only windows created by that
one specific process will be listed.
If it’s a filename, it much match exactly (no wildcards). You can enter
either a base name (e.g. /E:tcc.exe ) or a complete pathname
(e.g. /E:c:\bin\tcmd34\tcc.exe ). This syntax can
match multiple processes — you might have multiple copies of the same
program running at once. If you try to combine a process ID with a filename, the
process ID wins; the filename will be ignored.
/O: can sort by several criteria.
The available sort keys are:
C | sort by window class |
P | sort by process ID |
R | sort by thread ID |
S | sort by styles word |
T | sort by title |
V | sort by visibility |
W | sort by window handle |
X | sort by extended styles word |
- | reverses the following key |
These can be combined, e.g. /O:CT to sort by window
class name first, then by title where two windows have the same class. If
you do not give any /O:flags, the
default is to sort by window handles. To disable sorting altogether, you
can use /OU.
These are the tokens supported in the format string:
| Token: | Gives: |
|---|---|
$c | the window’s class name |
$h | the window handle |
$p | the window owner’s pid |
$s | the window’s styles word |
$t | the window’s title |
$v | V for visible or I for not visible |
$x | the window’s extended styles word |
$H | the window’s height |
$N | the name of the program which created the window |
$O | the handle of the window’s owner window |
$P | the handle of the window’s parent window |
$V | the name of the window’s virtual desktop, if available |
$W | the window’s width |
$X | the window’s left edge |
$Y | the window’s top edge |
$$ | dollar sign |
You can use modifiers between the dollar sign and the letter to change how the value is displayed:
| Modifier: | Changes the value: |
|---|---|
- | left-aligns a field |
0 | zero-pads a numeric field |
# | uses decimal instead of hex |
! | forces uppercase |
, | forces lowercase |
| width | set the field’s width (decimal only) |
A few character escapes are also supported:
| Escape: | Gives: |
|---|---|
\e | ASCII escape |
\k | backquote |
\n | newline |
\p | percent sign |
\q | double quote |
\r | carriage return |
\t | tab |
\\ | backslash |
\unnnn | Unicode character, up to U+FFFF |
\Unnnnnn | Unicode character, up to U+10FFFF |