Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Is there a way to initiate a download of a file from a web page, so this file will be opened by the user along with certain command line arguments?
For example:
<iframe width="1" height="1" frameborder="0" src="myprogram.exe arg1 arg2"></iframe> 

(this won't work, but just to clarify my idea)

What I have tried:

As you can see I tried using iframe and just added the command line arguments at the end of the executable path.
Posted
Updated 4-Apr-17 1:01am

No, this will not work because it is a huge security risk. You cannot execute the file on the client side. The user has to specify that they want to run it but by then your code is no longer in control. I suggest looking for a different way to accomplish what you need.
 
Share this answer
 
Comments
Michael Haephrati 4-Apr-17 7:10am    
I don't want to execute it but to offer the user to download it after payment via PayPal, and to have this download with an additional command line arguments based on the PayPal token and PayerID.
ZurdoDev 4-Apr-17 7:12am    
But downloads do not have command line arguments. Perhaps you can give them instructions on how to create a shortcut or how to run it from the command line with the extra arguments.
Do you really want a file to be downloaded and executed with a single click or even in the background?

That would be a security nightmare.

So the answer is:
There is no way to do this.
 
Share this answer
 
Comments
Michael Haephrati 4-Apr-17 7:09am    
I don't want the file to be automatically executed but as in any web site that offer software to be downloaded, I want that when the software IS downloaded by the user, and if the user chooses to open it, it will add command line arguments.
Jochen Arndt 4-Apr-17 7:25am    
The download is handled by the browser.
The offered actions like "Save as" and "Open with" depend on the file type. With executables there will be usually only "Save as".

It was possible in the past to use browser specific scripts to execute downloaded files. But actual browsers do not allow this anymore.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900