[Lazarus] Confusion with TProcess on Windows

Richard Mace richard.mace at gmail.com
Thu Aug 8 22:42:40 CEST 2013


Michael and Ludo,
You were both spot on, that's what it was.

Thanks guys.

Rich


On 8 August 2013 07:45, Ludo Brands <ludo.brands at free.fr> wrote:

> On 08/08/2013 08:02 AM, Richard Mace wrote:
> > Hi All,
> > I am baffled :)
> > If I open a command prompt, change to the directory which contains
> > plink.exe and run the command:
> >
> > plink -pw password root at 192.168.0.5 <mailto:root at 192.168.0.5> command
> >
> > The command works no problem, but if I do following in a TProcess I get
> > a "flash" of a black window, then nothing!
> >
> >   Process := TProcess.Create(nil);
> >   try
> >     sPSFTPFile := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)))
> > + 'plink.exe';
> >     Process.Executable := sPSFTPFile;
> >     S := '-pw ' + Password + ' ' + Username + '@' + IPAddress + ' ' +
> > Command;
> >
> >     Process.Parameters.Add(S);
> >     Process.Options := Process.Options + [poWaitOnExit];
> >     Process.Execute;
> >   finally
> >     Process.Free;
> >   end;
> >
> > Any ideas?
> >
> >
> You need to split the parameters. Parameters are the equivalent of
> paramstr() or argv on the receiving end. So something like:
>
> Process.Parameters.Add('-pw');
> Process.Parameters.Add(Password);
> Process.Parameters.Add(Username + '@' + IPAddress);
> Process.Parameters.Add('<mailto:root at 192.168.0.5>');
> Process.Parameters.Add(Command);
>
> Ludo
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130808/f81f8a8e/attachment-0003.html>


More information about the Lazarus mailing list