17

-Hello, looking for some help.

We currently have a winform app used to do approvals in our company. The app sends html emails to the "approvers" who read the relevant info in the email and click on a hyperlink which launches the app so they can do their approval.

Currently this is done by including the following in the email html:

<a href=file:///C:\Temp\test.exe>Click to Approve</a>

This correctly launches the app, after a couple of security warnings which we are OK with. We use Outlook 2010.

Now, in order to improve this process I would need to pass an argument identifying the approver to the app. This works correctly if I pass the argument from, say, a windows shortcut, however, I cannot find a way to pass the argument to the exe in the href attribute in order to do it from the email. I looked everywhere, and found nothing except questions.

I have tried the following to no avail:

<a href=file:///C:\Temp\test.exe approverID>Click to Approve</a> <a href=file:///C:\Temp\test.exe 'approverID'>Click to Approve</a> <a href="file:///C:\Temp\test.exe approverID">Click to Approve</a>

Also I have tried doing it with JavaScript, which from an HTML page works fine, but not from an email in Outlook.

I thought maybe there is a security threat with this approach hence it is not possible, but if I can successfully from an email run an exe, why can I not run an exe with parameters? It doesnt make sense.

Thank you for your help.

Leo

leoinlios
  • 831
  • 2
  • 9
  • 17

3 Answers3

9

after not getting any suitable responses and after continuing my research for this without success, I will temporarily conclude that what I am looking for is not possible. If the reasons for this not being possible concern security, then I am completely puzzled as to why running an exe without parameters is allowed and therefore considered LESS harmful than running an exe with parameters. Surely, an exe does not require parameters to be harmful. If anyone would care to elaborate on this, it would be educational for me, thank you.

Nevertheless, I have thought of an alternative to my problem, which is not as elegant as would otherwise be stating parameters in href, but it serves my purpose. Because our app is run from a network drive, I have changed it so that it creates user-specific cmd files on the network drive and the hyperlink in the email it creates points to these cmd instead of the exe. That way, the cmd files contains the call to the exe with the correct parameters and as the cmd files are very light and quickly written, this is OK.

I am closing this as "answered", but it is not.

Thanks for taking your time to read.

Leo

leoinlios
  • 831
  • 2
  • 9
  • 17
  • 1
    Thanks for the effort and the info... 2014, and I still can't find an elegant solution :-) – Riegardt Steyn Jan 14 '14 at 14:24
  • an answer saying a thing cannot be done is still an answer. Thanks for this. – eis Mar 17 '14 at 08:21
  • 1
    a very average solution to this is to create lots of little shortcuts that have different arguments in them, then hyperlink to one of these – Frank_Vr Apr 07 '14 at 06:25
6

I recommend you take a look to "How to create a protocol and assign it an app with parameters".

Example : http://kb.mozillazine.org/Register_protocol

http://msdn.microsoft.com/en-us/library/aa767914.aspx

David Bélanger
  • 7,400
  • 4
  • 37
  • 55
  • David, thank you. I looked at the info you provided and I cannot see how it relates to launching executables with arguments from an email. Also, it appears that it involves modifying the registry for the approvers machines. I cannot do that. The application is on a network drive and all aprovers just run it from that location, I would not have access to their computers. – leoinlios Apr 03 '12 at 14:38
  • Ah okay. Well, if you create a protocol, you may pass argument like this : `yourptotocol://arg1/arg2/etc` to a parameter in the registery who's gonna be something like `C:\\PAth\\blabla\\bob.exe %1 %2 %3` etc – David Bélanger Apr 03 '12 at 15:58
  • But my question was about passing parameters in the href attribute in HTML. I have no problem passing parameters to my application, the request is to do it from a link in an email. Thanks. – leoinlios Apr 03 '12 at 16:54
4

I have had the same problem and one alternative I have found was to create a .bat file that is attached to the e-mail that includes the command line and respective parameters, the user double-click the attachment, confirms that wants to open the file and the .bat runs. It is not as cleaner as the link but I guess It is an acceptable workaround in some cases. Important: My OS is Win7 and e-mail client is Lotus Notes, I am not sure if this alternative works with other mail clients/OSs .

Proletaryo
  • 41
  • 1
  • 1
    I know this question is old - but I used the href link to call the bat file which opened my app and passed in my parameters...this works great! and I used a network share as well so just having that one bat file was better than having multiple links per OPs answer. – jharr100 Apr 06 '15 at 22:19