3

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?

1 Answer 1

0

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.

11
  • 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, 2012 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, 2012 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, 2012 at 9:17
  • barlop, actualy you are right.
    – Greg0ry
    Jun 5, 2012 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, 2012 at 10:23

You must log in to answer this question.

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