Executing an application whose directory path contains blank spaces
From: Jean-Marc Molina (jmmolina_at_PASDEPOURRIEL-free.fr)
Date: 01/20/05
- Next message: aa: "cannot conect to fastcgi server"
- Previous message: CJ Llewellyn: "Re: basic tutorial"
- Next in thread: Alvaro G Vicario: "Re: Executing an application whose directory path contains blank spaces"
- Reply: Alvaro G Vicario: "Re: Executing an application whose directory path contains blank spaces"
- Reply: Paul Barfoot: "Re: Executing an application whose directory path contains blank spaces"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 20 Jan 2005 09:58:30 +0100
Hello,
I can't find a way to execute a Windows application, whose directory path
contains blank spaces, from a PHP script. I also wonder if the problem
happens under Linux and other OS.
Working dir : "C:\test copy"
"copy.php" PHP script :
<?php
system ('"C:\test copy\mycopy" /B "C:\test copy\folder1\file1" "C:\test
copy\folder2\file2"');
>
mycopy.bat batch :
copy %1 %2 %3
Executign this script I get the following error message :
« C:\>php "test copy\copy.php
'C:\test' is not recognized as an internal or external command,
operable program or batch file. »
If I replace « test copy » by « test » or « test_copy », it works.
The problem doesn't happen if the command parameters are not double quoted :
<?php
system ('"C:\test copy\mycopy" /B');
>
Note that you can just copy & paste these commands and see how they work in
a DOS command window.
How should I transform these blank spaces characters ? For example in a URL
you replace blank spaces by « %20 »...
The general idea is to execute an application located in the « "C:\Program
Files" directory. On the <http://www.php.net/manual/en/function.system.php>
page of the PHP manual someone proposed a solution but its command line
doesn't involve double quoted parameters.
-- Jean-Marc.
- Next message: aa: "cannot conect to fastcgi server"
- Previous message: CJ Llewellyn: "Re: basic tutorial"
- Next in thread: Alvaro G Vicario: "Re: Executing an application whose directory path contains blank spaces"
- Reply: Alvaro G Vicario: "Re: Executing an application whose directory path contains blank spaces"
- Reply: Paul Barfoot: "Re: Executing an application whose directory path contains blank spaces"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|