Jump to content

Archived

This topic is now archived and is closed to further replies.

dkirk

Trying to run batch file from browser?

Recommended Posts

Hello Gang,

 

I am trying to run a batch file from a php file via a web browser but cannot get it to execute. This is part of an intranet application and I am pulling my hair out trying to get it to work. The code below should work but when I call the page throught IE nothing happens. Any ideas?

<?php
exec("SyncNow.bat");
?>

Share this post


Link to post
Share on other sites
echo exec("SyncNow.bat");

Share this post


Link to post
Share on other sites

Thanks for the response but I have already tried this. The only thing this does is to write what would be displayed in the command prompt window to the browser??

Share this post


Link to post
Share on other sites

Sorry not too familiar with batch commands, have you tried system?

 

system("SyncNow.bat"); 

 

Take a gander at this.

Share this post


Link to post
Share on other sites

Hey no problem, I appreciate the help. I have already tried this as well

Share this post


Link to post
Share on other sites

Wait, you want the web browser to execute a batch script?

 

 

I can think of a couple of ways to have it do that, but none of them would be easy.

 

If browsers allowed execution of batch scripts, imagine all the security problems.  lol.

Share this post


Link to post
Share on other sites

Yeah, I think we need some clarification.

 

Do you want the batch file to be run on the server, or do you want the batch file run on the client's computer?

Share this post


Link to post
Share on other sites

Yeah...hope u realise that it would not be good to be able to run it in browser...

Share this post


Link to post
Share on other sites

The batch file is to be run on the server. This is to be a part of a small companies intranet so the security aspect is not a concern. User's must login to this specific page and there is not but a few user's that will even be granted access.

Share this post


Link to post
Share on other sites

I am basically trying to create a hyperlink that will launch a batch file. The batch file is used for file synchronization. Any help would be appreciated...

Share this post


Link to post
Share on other sites

×
×
  • 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.