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 have a few batch files in which I directly call taskkill command to kill running processes (because they interfere with these nightly build scripts). But recently, it seems after some Windows updates or possibly after some new software installation (windows updates are more likely, but I'm not sure) the command just hangs. Has anyone seen this kind of problem before and knows the fix?

This is how I'm executing my command which worked perfectly until a few days back.

taskkill /f /im <ProcessName.exe>

Now when I write this in the command prompt and press enter, it just stays there and never returns (and nothing happens).

Details: Windows 7 Enterprise, x64

share|improve this question

migrated from stackoverflow.com Mar 27 '13 at 14:17

This question came from our site for professional and enthusiast programmers.

    
As a workaround until you figure out the root cause, try wmic process where name="processname.exe" delete. This question might be better asked on superuser or serverfault. –  rojo Mar 7 '13 at 19:07
    
Thanks rojo. But this problem, which occurs intermittently for some reason, affects wmic as well. So on the next restart taskkill might just work, and in that case wmic will work too. But when taskkill doesn't work, even wmic gets stuck. I wish there was some way I could debug and find out what is causing it :(. –  Piyush Soni Mar 26 '13 at 5:56
    
I had a similar issue trying to kill tasks recently. The problem was a failing hard drive. It might be worth running hdtune to see whether you've got any failing sectors. –  rojo Mar 26 '13 at 17:07
    
@rojo : Humm ... You know what ... It might very well be! Because since this issue has started, somehow my Windows 7 makes me wait for something like 20 minutes at the "Please wait ... " screen at the boot time ... I'm suspecting this might have something to do with the hard drive. Will check with HD Tune and reply back. –  Piyush Soni Mar 26 '13 at 22:22

1 Answer 1

up vote 1 down vote accepted

So it turns out that the two problems on my system were related. For past some time, for some reason my System was taking too long to boot and stuck on the "Please wait ..." screen for like 15 to 20 minutes on my Windows 7 enterprise machine. I searched on the internet and observed that as soon as the machine finally boots up with Windows screen appearing, the svchost process was taking more than 1 Gig of RAM and 25% of my quad core machine to do something. Opened Process Monitor to see that it was doing something with the C:\Windows\System32\wbem\repository directory, which had grown up to 2.67 GB! I rebuilt it using this set of instructions by Scott Hanselman: http://www.hanselman.com/blog/SvchostexeSucksCPUAndRebuldingTheWMIWBEMRepository.aspx

And now the reboot time is reduced to normal again (~ 1 minute) and taskkill works again!

Edit 2013/04/25: Just to stress or validate that this is indeed a solution: It happened again with time (due to continuous WMI logging) my boot time on 'Please wait ...' or 'Welcome' screen went up to 25-40 minutes again, with the repository folder getting to the size of 1.89 GB. Since deleting the repository folder wouldn't help permanently as it'll grow again, this time with the help of a colleague I permanently disabled wbem logging by adding the RSoPLogging value to the registry as mentioned here: http://msdn.microsoft.com/en-us/library/windows/desktop/aa373502%28v=vs.85%29.aspx

It fixes both the reboot time taken, and the 'taskkill' method.

share|improve this answer

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.