How to create a link to run a ". bat" file that is inside the PHP directory?

Asked

Viewed 3,969 times

1

Everybody, good afternoon, everybody!

Next, I have a page in PHP that is open monitoring a link, I would like to know how I put a link that opens a file. bat that is in the same page directory...

Example:

"Shop 1 Down - Click here" <-- Clicking on this link would open a BAT that runs on the server.

I don’t want to do this with PHP itself, just call the BAT by Windows itself.

:P

2 answers

2


If you prefer to call via Javascript:

<input type="button" value="Click aqui" onclick="window.open('file:///C:pasta/teste.bat')" />

  • this method would run a file on the user’s machine, and in the question he wants it to run on the server.

  • is unfortunately so far failed! This you posted makes the file download, and actually I wanted to open it! And what’s even more complicated is Google Chrome :/ !!!

0

Try something like that:

system("cmd /c C:[caminho para o arquivo]");

The function System serves to run command on the application server.

  • is unfortunately so far failed! This you posted makes the file download, and actually I wanted to open it! And what’s even more complicated is Google Chrome :/ !!!

  • I think then Voce mixed things up, give a little look at the system function, it does not download, it performs something on the server

Browser other questions tagged

You are not signed in. Login or sign up in order to post.