Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

execute batch file from webpage

Status
Not open for further replies.

christenhusz

Technical User
Oct 31, 2002
166
NL
Hi,

i have some basic understanding of javascript and i have a question.

i have a webpage and i like to execute a batch file on the same server where the webserver is installed. I created a button on this webpage, but how do i execute a batch file with that button? This batch file copies some files from one directory to antoher..

is this possible should i use some other script language???? If you have some idea's i like to hear them!

thx!

christenhusz
 
Hi,

To be able to do that, you need a server side script. My favorit one is PHP. In PHP, it would look something like this (if the server is running in a windows environment
):

Code:
<?php
$output = shell_exec('do_stuff.bat');
echo "<pre>$output</pre>";
?>

This will run the do_stuff.bat and return the (screen) output to the browser.

But it do depend on the rights you have on the server/the configuration of the webserver.

Check out PHP at
On tek-tips : forum434

-if you like javascript, you're gonna love PHP :)

Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top