简体   繁体   中英

How to Pass Parameters to a client executable in a link

If I have a link in my page of the form:

<A HREF="/executable.exe?param=1">Run</A>

Are the parameters after the "?" passed to the executable after the browser has downloaded the executable, and the user has chosen to run the executable?

I have examined argv, and the environment, but doesn't seem to be there.

Is there any other place where the browser might be passing the parameters to the executable?

The parameters are just part of the url request.

What is done server side with it is completely up to you.

But if you expect the client to execute the file with those params, it will not work.

  1. The file won't be executed at all but only downloaded, and that probably with a warning (in modern systems)

  2. Once the file is Downloaded and the client executes it, it is just up the the client how he executes it. Nothing to do with your params any more

  3. There is however a hack in early versions of internet explorer 5 or even 6 but I won't talk about that here because it has no relevancy any more and is only an harmful expoit.

Link it to .cmd or a bat file which has the command to execute executable.exe with parameters.

So, your link should lookl ike

<a href ="/someth.cmd> Run me </a>

and the .cmd file should contain

executable.exe param1 param2 

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM