0

I want to make a program start running by typing in the file location in the url bar in google chrome, but if I try entering the file location, it downloads the file again. is the a plugin i can use?

CreeperHunter
  • 305
  • 1
  • 3
  • 13

1 Answers1

1

You cannot run an EXE file from typing a url. The way the browser works, it asks you to download or save the file, if there is an exe file name at the end of the url (and if there is one on the server)

To run the exe file the way you want it, you can use a scripting language such as PHP, ASP or any other. The way it will work, the script will look at the url and see if there is any command included. If it finds one, it executes an exec file using exec command. An example is below

exec("ping yahoo.com", $output, $return);
echo "The command returned $return, and output:\n";
echo "<pre>";
var_dump($output);
echo "</pre>";

Output

array(12) {
  [0]=>
  string(0) ""
  [1]=>
  string(55) "Pinging yahoo.com [72.30.38.140] with 32 bytes of data:"
  [2]=>
  string(0) ""
  [3]=>
  string(51) "Reply from 72.30.38.140: bytes=32 time=313ms TTL=50"
  [4]=>
  string(51) "Reply from 72.30.38.140: bytes=32 time=322ms TTL=50"
  [5]=>
  string(51) "Reply from 72.30.38.140: bytes=32 time=242ms TTL=50"
  [6]=>
  string(51) "Reply from 72.30.38.140: bytes=32 time=260ms TTL=50"
  [7]=>
  string(0) ""
  [8]=>
  string(33) "Ping statistics for 72.30.38.140:"
  [9]=>
  string(56) "    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),"
  [10]=>
  string(46) "Approximate round trip times in milli-seconds:"
  [11]=>
  string(53) "    Minimum = 242ms, Maximum = 322ms, Average = 284ms"

Note that the program will be run on the server computer where pages are hosted. So if you type http://www.yahoo.com/turn-off-lights. It will turn off lights in the yahoo building, not anywhere else.

TheTechGuy
  • 16,560
  • 16
  • 115
  • 136
  • In Windows, it is possible to open an .exe from a URL by [registering a custom protocol](https://stackoverflow.com/questions/80650/how-do-i-register-a-custom-url-protocol-in-windows). – Anderson Green Apr 12 '22 at 18:08