1

I'm new to php. In my php file, I have this command :

shell_exec("\"C:\path_with_spaces_to_.exe\" -c -n 1 C:\path_to_image\$image_name 2>&1");

Weird thing is my $image_name is never getting read. I believe maybe I miss some fundamental things. I tried many ways, but It's been 3 hours here and still stuck.

Any suggestion about what mistake do I have here ?

1 Answer 1

1

Its because you have to escape \ other wise it will escape $. Try this solution:

echo("\"C:\path_with_spaces_to_.exe\" -c -n 1 C:\path_to_image\\$image_name 2>&1");
Sign up to request clarification or add additional context in comments.

1 Comment

For other people, who had the same problem, there is another solution I found. But, @B. Desai answer still neater. Here is another solution for it using dot (.): shell_exec('"C::\path_with_spaces_to_.exe\" -c -n 1 C:/path_to_image/' . $image_name . ' 2>&1')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.