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.