VTS Posted April 2, 2007 Share Posted April 2, 2007 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 https://forums.phpfreaks.com/topic/45338-need-help-executing-a-bat-file-with-php/ Share on other sites More sharing options...
per1os Posted April 2, 2007 Share Posted April 2, 2007 <?php exec("path/to/file.bat"); ?> www.php.net/exec Also to run a .bat you need windows not linux. Link to comment https://forums.phpfreaks.com/topic/45338-need-help-executing-a-bat-file-with-php/#findComment-220129 Share on other sites More sharing options...
VTS Posted April 2, 2007 Author Share Posted April 2, 2007 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 https://forums.phpfreaks.com/topic/45338-need-help-executing-a-bat-file-with-php/#findComment-220140 Share on other sites More sharing options...
VTS Posted April 3, 2007 Author Share Posted April 3, 2007 Anyone have any ideas? Link to comment https://forums.phpfreaks.com/topic/45338-need-help-executing-a-bat-file-with-php/#findComment-220532 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.