Sign in to follow this  
Followers 0
ppat

Fail to kill DKService.exe process using ProcessClose()

7 posts in this topic

I installed diskeeper lite, which is a freeware to defragment drives. It can be downloaded here

To launch diskeeper lite, I run DkLite.msc. This launches a graphic interface for the user to chose which drive he wants to defragment. The associated process is mmc.exe. This is a usual process, can be closed by an AutoIT script via this code:

$PID = ProcessExists("mmc.exe"); Will return the PID or 0 if the process isn't found.
    If $PID Then ProcessClose($PID)

However, it also launches a second process called "DKService.exe", which sounds like a service to me. Anyway, when I manually close this process from the task manager, it works, however, from AutoIT with this code, it fails, the process lives on:

$PID = ProcessExists("DKService.exe"); Will return the PID or 0 if the process isn't found.
    If $PID Then ProcessClose($PID)

In this code, the process is found, but ProcessClose($PID) does *not* kill DKService.exe.

Could some one tell me how I can get rid of the process called "DKService.exe" from AutoIT?

I have to do this, because I run diskeeper from a USB drive, and I need to kill all processes launched from the USB drive before dismounting the drive.

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

try this

$Process = \"DKService.exe\"
If ProcessExists($Process) Then RunWait(\"taskkill /F /IM \" & $Process, \"\", @SW_HIDE)

if worked then tell me...

Edited by Jos07

Always Keep Your Sig Small... Like me :D

Share this post


Link to post
Share on other sites

Please avoid \\ with before commas.


Always Keep Your Sig Small... Like me :D

Share this post


Link to post
Share on other sites

I tried this code

$Process = "DKService.exe"
If ProcessExists($Process) Then RunWait("taskkill /F /IM " & $Process, "", @SW_HIDE)

But get Error on 2nd line "Unable to execute the external program". ANy further help?

Share this post


Link to post
Share on other sites

Excellent !

RunWait(@comspec & " /c Net stop diskeeper","",@SW_HIDE)

actually removes the process DKService.exe from the list. Thank you for this tip!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0