Saurabh Khirwal
Saurabh Khirwal

Reputation: 341

launch a folder in windows explorer with php

hi there i am trying to launch a folder in windows explorer but is dosent seem to work the code i am trying is

$contain_path = 'E:\Something\Some Folder';
$folder = '9999 - Some Folder Name Here';
$command = 'explorer "'.$contain_path.'\\'.$folder.'\\"';
system($command,$var);

i even tried, but didn't succeed with

system($command,$var);

Its just a local wampserver project. i am making it such that when i press a button. The ajax script call the php page and then php page executes the above code and then the explorer window pops up just like it does when i execute the command given above through command prompt. What am i doing wrong here?

Upvotes: 0

Views: 4147

Answers (2)

DrupalFever
DrupalFever

Reputation: 4364

Here is an answer to this problem. I am assuming that the PHP code will be running on a Windows PC. A possible situation would be if the user is running WAMP or a similar setup.

<?PHP

$file_location = 'C:\Users\User\Documents';
exec("start \"\" \"{$file_location}\"");

?>

Upvotes: 1

nl-x
nl-x

Reputation: 11832

quickest guess would be that explorer should be c:\windows\explorer.exe

Upvotes: 0

Related Questions