Page 1 of 1

execute batch file

Posted: Mon Jul 13, 2009 1:17 am
by mukeshgulia
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:

Code: Select all

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

Code: Select all

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

Code: Select all

<?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. :banghead:
Please help

Re: execute batch file

Posted: Mon Jul 13, 2009 4:33 am
by mukeshgulia
is anybody out there who can help

Re: execute batch file

Posted: Mon Jul 13, 2009 4:41 am
by jazz090
all batch files need to be executed via SSH. contact your web provider about how you can access it.

Re: execute batch file

Posted: Mon Jul 13, 2009 5:18 am
by jackpf
You can ftp stuff with php as well, if you can't use SSH.