summaryrefslogtreecommitdiff
path: root/packages/fcl-process/examples/demoproject.pp
blob: aabac46ec46f0202cf73ea901cb329c5497b5194 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
program demoproject;

{$mode objfpc}{$H+}

uses
  sysutils, process;

{$R *.res}

Var
  I : integer;

begin
  if ParamCount<>0 then
    begin
    Writeln('This is executable: "',ParamStr(0),'"');
    Writeln('Got parameters:');
    For I:=1 to 10 do
      Writeln('"',ParamStr(I),'"');
    end
  else
    With TProcess.Create(Nil) do
      try
        Executable:=ParamStr(0);
        Writeln(Format('Starting executable: "%s"',[Executable]));
        For I:=1 to 10 do
          Parameters.Add('Parameter '+IntToStr(I));
        Execute;
      finally
        Free;
      end;
end.