Search code examples
windowslazarusfreepascalexternal-application

How do I run an external application with Free Pascal/Lazarus?


How do I run an external application with Free Pascal/Lazarus (using Windows)? I found the "official" reference page, with several implementations and examples. Although I'm sure it works for many people, I, with my current knowledge level, am some what lost (I don't have much routine programming with Free Pascal yet, and other examples I found on the web didn't work for me).

Is there a "clear" example that helps me to do the "first steps"? Thanks.


Solution

  • If you don't need piping you can just use execute process.

    uses sysutils;
    begin
      executeprocess('notepad.exe',['document.txt']);
    end.