Jump to content

Execute batch file


mukeshgulia

Recommended Posts

Hi,

I tried to run a batch file via PHP functions exec()/passthru()/system()

Basically my batch file picks all the xml files from the current location and ftp them to a server.

 

None of the functions worked for me. Please help.

All files are located at the configured IIS folder Test IIS

 

batch file 'ftp.bat' contents are:

cd c:\windows\system32
ftp -s:c:\TestIIS\ftp.txt 128.91.16.203

 

'ftp.txt' file contains:

ora10g
ora10g
cd /home/oracle/dit/XMLDIR
prompt off
lcd c:\TestIIS
bin
mput *.xml
bye

 

I tried the following code:.

<?php
if(isset($_POST['submit']))
{
echo exec('ftp.bat');
echo "Done!";
} else {
// display the form
?>
<form action="" method="post">
<input type="submit" name="submit" value="DO IT!">
</form>
<?php
}
?>

 

I am unable to run this file successfully.

Please help

Link to comment
https://forums.phpfreaks.com/topic/165763-execute-batch-file/
Share on other sites

Archived

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

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