std.process.system and white spaces

Jimmy Cao jcao219 at gmail.com
Wed Jun 29 07:06:16 PDT 2011


Try this:

std.process.system("cmd /c \"c:\\Program Files\\some program.exe\" >
\"c:\\file name\"");

If that doesn't work then you may have to do it like this:
http://msdn.microsoft.com/en-us/library/ms682499(VS.85)

On Wed, Jun 29, 2011 at 5:58 AM, s4mmael <fake at mail.com> wrote:

> Hi all!
>
> I'm trying to run the following command with the 'system' function:
> std.process.system("\"c:\\Program Files\\some program.exe\"");
> Because it's double quoted it's OK.
>
> Now I want to redirect an output of "some program.exe" to a file:
> std.process.system("\"c:\\Program Files\\some program.exe\" >
> c:\\filename");
> And it works well too.
>
> Then I'm trying to quote a 'filename' in case in includes a white space:
> std.process.system("\"c:\\Program Files\\some program.exe\" > \"c:\\file
> name\"");
> but I got the following message on a standard output:
> 'c:\Program' is not recognized as an internal or external command, operable
> program or batch file.
>
> What is the right method to quote both paths in case of redirection to a
> file?
> Thank you beforehand for the answer. Any advice would be greatly
> appreciate.
>
> Thanks beforehand for the answer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110629/2d624230/attachment.html>


More information about the Digitalmars-d mailing list