Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can set title via windows shell using command title some string but how can I get the title of some process?

I tried command tasklist /v, but my title is very, very long, that's why I receive only partial title. Also I was thinking about wmic utility, but can't find desired flag.

share|improve this question
Pipe the output of tasklist to a text file? – iglvzx Jan 16 '12 at 0:03
What is wmic utility? – skub Jan 16 '12 at 0:14
Nevermind, I just piped the output to a text file. The title is still truncated. AutoHotkey can achieve what you want, however. Give me a bit to write a script for the job. :) – iglvzx Jan 16 '12 at 4:19

AutoHotkey can help you achieve this. Let's write a script that outputs the process and titles of all open windows to stdout:

WinGet, windows, list

Loop, %windows%
    id := windows%A_Index%
    WinGet, process, ProcessName, ahk_id %id%
    WinGetTitle, title, ahk_id %id%
    FileAppend, %process% %title%`n, *


Compile the script to get a portable .exe.

Now, we can run the following from the Windows command line:

MyScript.exe | more



share|improve this answer
is there any way to do it without AutoKey? Don't want to use external utility – loveWinux Jan 16 '12 at 14:13
Hmm. After comparing the output of tasklist /v and my script, there is discrepancy. My script only picks up processes which register a window, while tasklist seems to get it's information elsewhere. I'll see if I can figure out how to get the same outputs. – iglvzx Jan 16 '12 at 19:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .