demoruncommand.pp 434 B

1234567891011121314151617181920212223
  1. {$mode objfpc}
  2. {$h+}
  3. program demoruncommand;
  4. {
  5. Demonstrate the RunCommand program.
  6. Before running this demo program, compile the echoparams program first,
  7. make sure both binaries are in the same directory.
  8. }
  9. uses sysutils, process;
  10. Var
  11. S : String;
  12. begin
  13. if RunCommand(ExtractFilePath(ParamStr(0))+'echoparams',['a','b','c'],S,[]) then
  14. Writeln('echoparams returned : ',S)
  15. else
  16. Writeln('Command failed');
  17. end.