Jump to content

Need help executing a .bat file with PHP


VTS

Recommended Posts

Well as the title states, I have a .bat file that copies certain files across a network and I needed a way to run this file using PHP.  I was looking at exec() but I was not sure exactly how to use it.  I was also using pstools but could not get them to work with PHP.  Can someone give me an example of how to do this or send me somewhere where I can read up on this?

 

thanks in advance,

 

vts

Link to comment
Share on other sites

Thanks for the info.  I tried using this:

 

<?php
exec("c:\\test.bat");
?>

 

When I ran it, nothing happened.  The .bat file works when I just run it so I know it is not the .bat file messing up.  I also tried using "c:\test.bat" and "c:/test.bat" and none of them worked either.  What am I missing? 

 

 

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.