ppat Posted May 26, 2008 Posted May 26, 2008 I installed diskeeper lite, which is a freeware to defragment drives. It can be downloaded hereTo 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.
Jos07 Posted May 26, 2008 Posted May 26, 2008 (edited) try this $Process = \"DKService.exe\" If ProcessExists($Process) Then RunWait(\"taskkill /F /IM \" & $Process, \"\", @SW_HIDE) if worked then tell me... Edited May 26, 2008 by Jos07 Always Keep Your Sig Small... Like me :D
Jos07 Posted May 26, 2008 Posted May 26, 2008 Please avoid \\ with before commas. Always Keep Your Sig Small... Like me :D
ppat Posted May 27, 2008 Author Posted May 27, 2008 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?
Developers Jos Posted May 27, 2008 Developers Posted May 27, 2008 Have you tried stopping the started service? Something like: RunWait(@comspec & " /c Net stop diskeeper","",@SW_HIDE) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ppat Posted May 28, 2008 Author Posted May 28, 2008 Excellent ! RunWait(@comspec & " /c Net stop diskeeper","",@SW_HIDE) actually removes the process DKService.exe from the list. Thank you for this tip!
Developers Jos Posted May 28, 2008 Developers Posted May 28, 2008 Its always better to shut things down the nice way before using the "sledgehammer" SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now