Browse Source

* quote parameters with spaces

git-svn-id: trunk@10111 -
peter 17 years ago
parent
commit
69363bad5e
2 changed files with 25 additions and 18 deletions
  1. 12 9
      rtl/win/sysutils.pp
  2. 13 9
      rtl/wince/sysutils.pp

+ 12 - 9
rtl/win/sysutils.pp

@@ -866,16 +866,19 @@ end;
 
 
 function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array of AnsiString):integer;
 function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array of AnsiString):integer;
 
 
-Var
-  CommandLine : AnsiString;
-  i : Integer;
+var
+  CommandLine: AnsiString;
+  I: integer;
 
 
-Begin
-  Commandline:='';
-  For i:=0 to high(ComLine) Do
-   Commandline:=CommandLine+' '+Comline[i];
-  ExecuteProcess:=ExecuteProcess(Path,CommandLine);
-End;
+begin
+  Commandline := '';
+  for I := 0 to High (ComLine) do
+   if Pos (' ', ComLine [I]) <> 0 then
+    CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
+   else
+    CommandLine := CommandLine + ' ' + Comline [I];
+  ExecuteProcess := ExecuteProcess (Path, CommandLine);
+end;
 
 
 Procedure Sleep(Milliseconds : Cardinal);
 Procedure Sleep(Milliseconds : Cardinal);
 
 

+ 13 - 9
rtl/wince/sysutils.pp

@@ -676,16 +676,20 @@ end;
 
 
 function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array of AnsiString):integer;
 function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array of AnsiString):integer;
 
 
-Var
-  CommandLine : AnsiString;
-  i : Integer;
+var
+  CommandLine: AnsiString;
+  I: integer;
+
+begin
+  Commandline := '';
+  for I := 0 to High (ComLine) do
+   if Pos (' ', ComLine [I]) <> 0 then
+    CommandLine := CommandLine + ' ' + '"' + ComLine [I] + '"'
+   else
+    CommandLine := CommandLine + ' ' + Comline [I];
+  ExecuteProcess := ExecuteProcess (Path, CommandLine);
+end;
 
 
-Begin
-  Commandline:='';
-  For i:=0 to high(ComLine) Do
-   Commandline:=CommandLine+' '+Comline[i];
-  ExecuteProcess:=ExecuteProcess(Path,CommandLine);
-End;
 
 
 Procedure Sleep(Milliseconds : Cardinal);
 Procedure Sleep(Milliseconds : Cardinal);