1

I made a batch file that kills a couple tasks and restarts them like so:

taskkill /f /im "task1.exe"
taskkill /f /im task2.exe
start C:\path\task.exe

This bat file runs fine when run through a cmd prompt. However, when trying to run it through NppExec, the first taskkill fails with Reason: Access is denied. The second taskkill and the start work fine.

Why might one fail and another succeed when running the batch via command prompt has both succeed? How might I fix it so both tasks end?

  • Have you tried running Notepad++ as an administrator? Taskkill can be fickle with some running apps based on who launched them. Admin mode can sometimes overcome this, though I'm not sure how the NppExec plugin actually launches things. – techturtle Oct 24 '17 at 17:32
  • @techturtle That was it, thank you. I have an admin command line pinned to the taskbar so I forgot I was in an admin console. If you'd like to make an answer out of that comment, I'd be happy to accept it. – David Starkey Oct 24 '17 at 17:40
1

Try running Notepad++ as an administrator. If you use multiple users on the system, you may also want to check which user is running the app. Taskkill can be fickle with some running apps based on who launched them. Admin mode can sometimes overcome this, though I'm not sure how the NppExec plugin actually launches things.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.