So I'm writing an app that needs to end explorer.exe before it installs. However, when using the following code Windows automatically restarts the process:
Dim proc() = System.Diagnostics.Process.GetProcessesByName("explorer.exe")
For Each item as Process in proc()
item.Kill()
Next
Due to this problem I found a way to kill explorer.exe using taskkill here's the code and it works perfectly fine:
Dim taskkill as New ProcessStartInfo
taskkill.FileName = "cmd.exe"
taskkill.Arguments = "/c taskkill /F /IM explorer.exe"
taskkill.WindowStyle = ProcessWindowStyle.Hidden
Process.Start(taskkill)
But I don't want to depend on cmd.exe to do that task? Can somebody tell me how to do this using vb.net or c# code?
Thanks.
this may be not a good practice of posting others answers,so please forgive me,i just meant to guide you by providing a small light to your problem. this answer is actually from superuser provided by t3hn00b..All credits to him
to start with ,the windows (windows 7 and XP) use a registry key to automatically restart the explorer process.so to disable we have to programatically reset the value of that key,we can use the code.
or in C#
Anyway i dont recommend changing windows default settings for a problem which have alternatives(using cmd.exe).
the code will have errors,forgive me for that too.just tried to give your problem a little start.try and check it,it is proved to work well in win7 and XP. you can see more details in the superuser link above.Hope it will help.Thanks to the t3hn00b.