Re: ShellExecute
From: Davids (nowhere_at_nowthere.com)
Date: 12/23/03
- Next message: Robert Marquardt: "Re: Returning String Array from Delphi DLL to Java"
- Previous message: Neil: "close new processes?"
- In reply to: Alan: "Re: ShellExecute"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 23 Dec 2003 11:19:47 -0700
The redirection operators, (<, >, >>, and variations) are part of the command
line interpreter. Althought this API function is called "shellexecute" I doubt
it's sending the command to the CLI; rather, the CLI most likely calls
"shellexecute" to process commands. I've never ever seen any function that
processes command line file redirection operators. The way the CLI usually
works is to attach files of the given names to stdin, stdout, and stderr (as
needed) and THEN execute the command. The shellexecute command is designed to
take file handles to just such pre-opened files.
Your solution here works because batch files are submitted to the CLI (cmd.exe
in WinNT, command.com in Win9x). It's a perfectly acceptable solution.
However, by simply opening the output file (c:\testbackkup.sql) and passing its
write handle as the parameter for stdout when you call shellexecute, you'd get
the desired behavior.
-David
Alan wrote:
> Thank you for your advice.
>
> For the immediate remedy, I found the solution is the put the mysqldump
> statement -
> c:\mysql\bin\mysqldump -h server1 -u
> john -pjohn --extended-insert --databases test > c:\testbackkup.sql
> into a batch file called mysqldump.bat:
>
> shellexecute(Handle,
> 'open',
> 'C:\mysqldump.bat',
> nil,
> nil,
> SW_SHOWNORMAL);
>
> It works and I can find the backup sql file.
> However, I will try to find the solution so that I can put the mysqldump
> statement into the ShellExecute or CreateProcess API as parameter.
>
> "Rob Kennedy" <.> wrote in message news:3fe69464$1@newsgroups.borland.com...
> > Alan wrote:
> > > So what should I fill in the mysqldump parameters list instead of using
> the
> > > '>' ?
> >
> > As I just said, use the TStartupInfo record with the CreateProcess
> > function -- ShellExecute will be useless. Go read about CreateProcess on
> > MSDN first. I suggested that you would be replacing the standard output
> > handle for the new process. And I'll mention again that RedCon will help
> > you solve your problem, and that Google Groups is a useful resource.
> >
> > --
> > Rob
- Next message: Robert Marquardt: "Re: Returning String Array from Delphi DLL to Java"
- Previous message: Neil: "close new processes?"
- In reply to: Alan: "Re: ShellExecute"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|