c00000fd
c00000fd

Reputation: 22293

What are exit codes from the taskkill utility?

In my MSI installer custom-action handler (done with C++) I cannot obtain the SE_DEBUG_NAME privilege to be able to open and terminate a process, thus I have to resort to doing it with the taskkill utility as such:

taskkill /f /pid 1230

What I need to know are the return codes from the taskkill to be able to see if the process was terminated or not and the reasons why it may not have been.

I was able to obtain the following experimentally on my Windows 8 machine:

0 = success
1 = access denied
128 = no such process

Is there an official documentation for these?

Upvotes: 15

Views: 15148

Answers (2)

DuartePinguim
DuartePinguim

Reputation: 13

I'm creating an application that also uses batch scripts and although I haven't found a list of all the errors I can also say that:

  • (Code 128) indicates that the specified process was not found running on the system
  • (Code 0) indicates that the specified process was found and killed with sucess

The image below shows windows 11 executing the “taskkill” command on the “discord.exe” process and displays the error messages that follow the execution of the commands.

Image that show the executation fo command taskkill

Upvotes: 0

Overlord_Dave
Overlord_Dave

Reputation: 912

Official error code documentation is at:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381(v=vs.85).aspx

Unfortunately this covers ALL windows error codes, which may well be shared between applications.

However the two you mentioned above are on there. For example, 128 is listed as 'There are no child processes to wait for.'

Upvotes: 5

Related Questions