Process

◷ Reading Time: 2 minutes

processRun

Executes a process and runs a command.

 processRun (path, args, cfg)
  • path (String): Command name or full path (Mandatory)
  • args (String): Arguments of the command (Optional)
  • return: A result object of {output, error, hasError}
    • output: success output of command
    • error: error output of the command
    • hasError: A boolean value indicates if something has gone wrong on the execution
  • cfg: Configuration object that can specify:
    • user: Account name
    • domain: Domain of user
    • password: Password of the account
    • verb: Verb for command (i.e., runas)
Example: list = processRun ('cmd.exe', '/c dir').output 

Result: 
Volume in drive C is OS
  Volume Serial Number is 0AEE-F134
 Directory of C:\Users\Subhashi\Documents\New Applications
 09/12/2020  01:47 PM    
          .
 09/12/2020  01:47 PM              ..
                0 File(s)              0 bytes
                2 Dir(s)  10,915,409,920 bytes free

Returns the result of dir command sets it in the list parameter
Example: list = processRun ('cmd.exe', '/c dir')

Result: 
{
     "output" : "Volume in drive C is OS\r\n Volume Serial Number is 0AEE-F134\r\n\r\n Directory of C:\Users\Subhashi\Documents\New Applications\r\n\r\n09/12/2020  01:47 PM    \u003cDIR\u003e          .\r\n09/12/2020  01:47 PM    \u003cDIR\u003e          ..\r\n               0 File(s)              0 bytes\r\n               2 Dir(s)  10,914,062,336 bytes free",
     "hasError" : false,
     "error" : null
 }
Example: list = processRun ('ipconfig.exe')

Result: 
Windows IP Configuration
 Ethernet adapter Ethernet:
 Media State . . . . . . . . . . . : Media disconnected
    Connection-specific DNS Suffix  . : 
 Ethernet adapter vEthernet (DockerNAT):
 Connection-specific DNS Suffix  . : 
    Link-local IPv6 Address . . . . . :
.
.
.
.
.

processList

Lists all the running processes.

 processList ()
Example: processList ()
Result: Returns a list of running processos with more details.

processKill

Kills a running process.

 processKill (processId)
  • processId (Integer): Id of the process you want to kill (Mandatory)
Example: processKill (28472)
Result: Kills the process with the ID 28472.
Updated on January 13, 2021

Was this article helpful?

Related Articles