File Path Rules for PHP exec()

What are the 'rules' for specifying file paths for PHP's exec() function?  I am running PHP under Apache 2 in Windows XP.  I gather that the path separators need to be forward slashes.  I have not worked out what to do with spaces, though.  If there are any spaces in my file paths execution fails.  How can I escape spaces?  Also, are there any other Windows allowable characters that are likely to cause problems?

Mike

shachoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michael701Commented:
you could use quotes around the file names in the exec

ie xp allows

copy "c:/temp/my file.txt" "d:/whatever.txt"

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
shachoAuthor Commented:
I tried that earlier, but it also fails for the same reason.  I get an error message saying the file cannot be executed and it displays the path all the way up to the first space.
0
Michael701Commented:
did the path that was displayed have a quote before the file name?

can you post an example?
0
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

shachoAuthor Commented:
Problem solved.  The quotes need to be inside the text that is sent to the shell (I should have guessed that right off) so:

exec('C:/my folder/file.vbs')   //does NOT work (single quotes)
exec("C:/my folder/file.vbs")   //does NOT work (double quotes)
exec('"C:/my folder/file.vbs"')   //DOES work (double quotes INSIDE single quotes)

...which is probably what you meant by the first post, yes?

0
Michael701Commented:
yep, that's it
0
shachoAuthor Commented:
Great.  Thanks a lot for your help!

Mike

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.