From Lazarus wiki
Jump to navigationJump to search
English (en) │
suomi (fi) │
français (fr) │
polski (pl) │
TProcess is a non-visual component on the System tab of the Component Palette that enables easy execution of external programs.
Some of the benefits of using TProcess are that it is:
- Platform Independent
- Capable of reading from stdout and writing to stdin.
- Possible to wait for a command to finish or let it run while your program moves on.
- TProcess is not a terminal/shell! You cannot directly execute scripts or redirect output using operators like "|", ">", "<", "&" etc. It is possible to obtain the same results with TProcess using pascal, some examples are below..
- Presumably on Linux/Unix: you must specify the full path to the executable. For example '/bin/cp' instead of 'cp'. If the program is in the standard PATH then you can use the function FindDefaultExecutablePath from the FileUtil unit of the LCL.
- On Windows, if the command is on the path, you don't need to specify the full path.
See the TProcess examples in Executing External Programs.
If there is need for UTF-8 string passing, use TProcessUTF8 instead.
Ported To Delphi
TProcess has also been ported to work on Delphi (currently on MS Windows, soon macOS also).
The delphi port is being worked on here: