Jump to content

PHP system() not responding correctly


BirdieUK

Recommended Posts

Hi,

I have a windows xp home edition computer running xampp and for some reason, the following programs will not work when called upon.

$command = "iexplore.exe www.google.com";
   system($command);
   $command2 = "C:\\xampp\\htdocs\\spotifyControl\\playpause.ahk";
   system($command2);

Both commands, when in command prompt, work perfectly... any ideas?? Thanks.

Link to comment
Share on other sites

I've run into trouble with exec() on Windows before due to not having my quotes set up correctly.

 

for some reason when using exec() on windows with a path that has spaces in it, not only do you need to enclose the path itself in double quotes, but the entire exec'd command needs to be enclosed in double quotes as well. Try your call as:

 

$command = "\"iexplore.exe www.google.com\"";

 

or

 

$command = "\"iexplore.exe\" \"www.google.com\"";

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.