Run an executable with arguments from an HTML mail message

N

nbrege

I want one of my applications to send an HTML email message to a user with a
hyper link in it to start up an executable with arguments passed to it. It
works fine if I just specify the executable path with no arguments. But if I
pass the arguments then Outlook says it can't find the file.

Here is the line that I add to the email message body to start the exe only:

"<a href="""C:\program files\someFolder\myApp.exe""">Click here</a> to run
program."

but if I add the arguments it doesn't work:

"<a href="""C:\program files\someFolder\myApp.exe cust=1234
order=5678""">Click here</a> to run program."

Has anyone done this before or know what I need to do to make it work with
arguments? Thanks...
 
M

MarceepooNu

I am very ignorant when it comes to HTML, but I think I see where your
problem is.
Here's some coding, which includes an ampersand to join two strings, and
therefor probably isn't proper in an HTML context, but the following might
give you an idea that you could code properly in HTML:

"<a href="""C:\program files\someFolder\myApp.exe""" & """cust=1234
order=5678""">Click here</a> to run program."

Sorry if I wasted your time.

MarceepooNu
 
M

MarceepooNu

I'm very ignorant when it comes to HTML, but I think I see the vbscript
problem. If I'm right, it has to do with the spaces in the path.

I think HTML doesn't use the amperand (&) to join two strings; so the
following code probably won't work; but I bet you'll know how to correct my
error. So, here's my [wrong] code:

"<a href="""C:\program files\someFolder\myApp.exe""" & """cust=1234
order=5678""">Click here</a> to run program."

I apologize if this wasn't helpful, and instead a waste of your time.
 
D

Dan Mitchell

nbrege said:
I want one of my applications to send an HTML email message to a user
with a hyper link in it to start up an executable with arguments
passed to it. It works fine if I just specify the executable path
with no arguments. But if I pass the arguments then Outlook says it
can't find the file.

There's no way to do this, URLs can't contain command-line arguments.
Outlook doesn't matter here, it's just not possible.

Here's some alternative approaches, assuming you control the server
that it's being downloaded from, and the code that's being run:

1. Request is "dostuff.exe?order=1234"; the server 302 redirects to
"dostuff_order_1234.exe", and dostuff.exe checks its own filename and
pulls command-line arguments out of there

2. Server drops a cookie with "order=1234" when it gets the request;
dostuff.exe reads cookies back out when it starts (this is probably
impossible on newer versions of Firefox, they changed the cookie code so
this is much more difficult than it used to be)

3. append bytes with the arguments to the executable, executable reads
its own binary at launch time. Works fine, but breaks code signing.

4. server downloads a zip file with a batch file in there, user runs
the batch file, batch file contains "dostuff order=1234"

5. define new file extension, '.dostuff'; user downloads a .dostuff
file containing "order=1234", associate .dostuff with your executable.


-- dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top