PHP popen()带引号的路径

I'm trying to run an exe file with PHP's popen() function in Windows. Everything is perfect except if my .exe file has spaces in it's path. So this works:

popen("start /b D:\\test.exe", r);

this doesn't:

popen("start /b D:\\path with space\\test.exe", r);

Normally in CMD when you want to do that you just put the path in quotes like: "D:\path with space\test.exe" and this works ok with exec() function but not with popen().

I've tried:

popen('start /b "D:\\path with space\\test.exe"', r);

but it doesn't work.

Anyone has any idea how to do this ?

Use the escapeshellarg() function to add the spaces.