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.

If I'm running many instances of cmd.exe and only know the name of .bat file one of them executes, could I use taskkill to find and kill exact cmd.exe process?

share|improve this question
add comment

1 Answer

I would suggest another solution:

wmic process get caption,commandline,processid

I could see .bat file name as parameter for cmd invoked by at command.

share|improve this answer
    
I don't see anything in /V that the poster could use that'd do it. If you run a batch file like a.bat with the line pause, then try to find which cmd.exe is running it. your answer doesn't do that. i've improved his title –  barlop Jun 5 '12 at 9:07
    
What system are you using? On my win2k3srv I can see 'Window Title' column and for CMD when you run command it appears on tittle bar. –  Greg0ry Jun 5 '12 at 9:11
    
As far as I can see it works pretty much like 'ps ax' in linux. So in my example I can see 'C:\Windows\system32\cmd.exe - tasklist /V' in this column. –  Greg0ry Jun 5 '12 at 9:17
    
barlop, actualy you are right. –  Greg0ry Jun 5 '12 at 10:04
    
(I use gnuwin32 hence grep), I did something like tasklist /V | grep -i "bat" so I saw pretty quickly it didn't show.. and I noticed a.bat doesn't show in task manager, i'm not sure if/where it shows in process explorer, but if it does then a cmd line version should do it though i don't know if it does or if there is one... –  barlop Jun 5 '12 at 10:23
show 6 more comments

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.