pascalabcnet/Utils/ProgrammRunner/ProgrammRunner.pas

22 lines
934 B
ObjectPascal
Raw Permalink Normal View History

// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
2015-06-12 21:59:28 +03:00
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
2015-05-14 22:35:07 +03:00
begin
var args := System.Environment.GetCommandLineArgs();
2018-03-04 13:57:31 +03:00
var args2 := new string[args.Length > 3?args.Length-3:0];
for var i := 3 to args.Length - 1 do
args2[i-3] := args[i];
2015-05-14 22:35:07 +03:00
var psi := new System.Diagnostics.ProcessStartInfo();
psi.FileName := args[1];
2018-03-04 13:57:31 +03:00
psi.Arguments := string.Join(' ', args2);
2015-05-14 22:35:07 +03:00
//psi.CreateNoWindow := true;
psi.UseShellExecute := false;
var p := new System.Diagnostics.Process();
p.StartInfo := psi;
p.Start();
p.WaitForExit();
2018-03-04 13:57:31 +03:00
var msg := 'Программа завершена, нажмите любую клавишу . . .';
if args[2] = 'en-US' then
msg := 'Program is finished, press any key to continue . . .';
System.Console.WriteLine(msg);
2015-05-14 22:35:07 +03:00
System.Console.ReadKey(true);
end.