C# Why can I not programmatically kill a console program started in Task Scheduler? -


i have console program run daily batch. have ui can use alter parameters in db console program uses.

i thought great able stop , start program ui , can that.

however, have console program set start before work day using task scheduler in case machine should rebooted - @ least know program running when day starts.

however, cannot kill when has been started task scheduler. "access denied".

why? , how can solve this?

try using following method:

private void killprocessbyprocessname(string strprocessname) {     foreach (process p in system.diagnostics.process.getprocessesbyname(strprocessname))         p.kill(); } 


e.g:

private void btnprocesskiller_click(object sender, eventargs e) {     killprocessbyprocessname("winword"); } 

Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -