[Overview][Classes][Procedures and functions][Index] |
Executes a command found in the current PATH environment.
Source position: utf8process.pp line 54
procedure RunCmdFromPath( |
const ProgramFilename: string; |
const CmdLineParameters: string |
); |
ProgramFilename |
|
Path and name for the program executed. |
CmdLineParameters |
|
Command line parameters for the program. |
RunCmdFromPath is used to execute a command which can be found in the current PATH environment. For example, the following locates and executes the /bin/ls -l /home command:
RunCmdFromPath('ls', '-l /home');
An exception is raised if the program file cannot be located, or cannot be executed.
RunCmdFromPath creates and configures a TProcessUTF8 instance which is used to execute the program file. ProgramFilename contains the qualified executable file name for the process. If the argument contains a Space (' '), it is surrounded by Quotation Mark (") characters before it is assigned to the class instance. CmdLineParameters contains optional parameters values for the executable file. It is assumed that parameter values with embedded spaces are already quoted when passed to the routine. CmdLineParameters is included in the class instance when the value is not an empty string ('').
RunCmdFromPath calls the Execute method in the TProcessUTF8 instance to execute the specified program file name with the specified parameter values.
Version 3.2 | Generated 2024-02-25 | Home |