This function launches an external executable and returns a handle that can be used for interaction.
Process CreateProcess(string path, string arguments)
Parameter | Description |
---|---|
path | file path of the executable to launch |
arguments | command-line arguments to pass to the program |
If the program was launched, a new process is returned. Otherwise, nil is returned.
Print("Launching process")
local proc = CreateProcess("C:/Windows/notepad.exe")
Print("Process running")
local exitcode = proc:Wait()
Print("Process ended (" .. tostring(exitcode) .. ")")