SpKillAll

The full-qualified file names of the modules running as processes on the system are matched against a substring. On success, the process gets flagged to end.

Syntax: numberKilled = spKillAll ( [ [action] ,] substring )

Parameters: action – The value 'DKP_PROCESSTREE' is used to kill a process and all its descendant processes. The process must be either the current process, or it must have been directly created by the current process using DosExecPgm with a value of 2 (EXEC_ASYNCRESULT) for execFlag.

'DKP_PROCESS' is used to kill any process. This is the default value.

Aliases for 'DKP_PROCESSTREE': 'PROCESSTREE', 'TREE', 'T'.

Aliases for 'DKP_PROCESS': 'PROCESS', 'P'

substring – Part of the filename. Prepend a backslash to full filenames to prevent the kill of processes which filenames contain substring as suffix, e.g. XFILE.EXE and E.EXE.

Returns: Number of processes killed.

Example Code: /* killall.cmd (spUtils Example Code) */ /* Kills all processes which run the specified exe file. */ CALL RXFUNCADD 'spKillAll','spUtils','spKillAll ' PARSE UPPER ARG exe rest IF POS('\',exe)=0 THEN exe='\' || exe IF RIGHT(exe,4)\='.EXE' THEN exe=exe || '.EXE' SAY spKillAll(exe) || ' process(es) killed'