Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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, *
}

ExitApp

Compile the script to get a portable .exe.

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

MyScript.exe | more

Example:

screenshot

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.