Forces the first matching process to close.

ProcessClose PIDOrName



Type: Integer or String

Specify either a number (the PID) or a process name:

PID: The Process ID, which is a number that uniquely identifies one specific process (this number is valid only during the lifetime of that process). The PID of a newly launched process can be determined via the Run function. Similarly, the PID of a window can be determined with WinGetPID. ProcessExist can also be used to discover a PID.

Name: The name of a process is usually the same as its executable (without path), e.g. notepad.exe or winword.exe. Since a name might match multiple running processes, only the first process will be operated upon. The name is not case sensitive.

Return Value

Type: Integer

This function returns the Process ID (PID) of the specified process. If a matching process is not found or cannot be manipulated, zero is returned.


Since the process will be abruptly terminated -- possibly interrupting its work at a critical point or resulting in the loss of unsaved data in its windows (if it has any) -- this function should be used only if a process cannot be closed by using WinClose on one of its windows.


Run, WinClose, WinKill, Process functions, Win functions


#1: Forces Notepad to close (be warned that any unsaved data will be lost):

ProcessClose "notepad.exe"