Run an executable with arguments from an HTML mail message

Status
Not open for further replies.
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

MarceepooNu

"nbrege" wrote:


> 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'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.

MarceepooNu

"nbrege" wrote:


> 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...
>
 
D

Dan Mitchell

nbrege <nbrege> wrote in

news:C14FB3AD-923E-4D68-B4A7-634BC94C47AC@microsoft.com:
> 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
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
K Run a script rule to auto 'send again' on undeliverable emails? Outlook VBA and Custom Forms 1
G Save attachment run a script rule Outlook VBA and Custom Forms 0
U Outlook 2019 VBA run-time error 424 Outlook VBA and Custom Forms 2
D Outlook 2013 Macros only run in VB editor, not in drop down or button Outlook VBA and Custom Forms 10
D We're sorry but outlook has run into an error Using Outlook 6
M White square in body of Outlook Messages (O2016 Version 2012 32bit Click To Run) Using Outlook 4
E Having some trouble with a run-a-script rule (moving mail based on file type) Outlook VBA and Custom Forms 5
C Auto Run VBA Code on new email Outlook VBA and Custom Forms 1
Aussie Rules Run a Script on an Incoming Email OK and then the Email reverts Outlook VBA and Custom Forms 0
A Apply Selected Emails to outlook rules and Run Rules Using Outlook 5
B VBScript doesn't run on Recipient Email Outlook VBA and Custom Forms 2
A Run-time error '430' on certain emails when trying to set "Outlook.mailitem" as "ActiveExplorer.Selection.Item" Outlook VBA and Custom Forms 2
S Outlook Custom Form Scripting only working when clicking on "Run this form" Outlook VBA and Custom Forms 2
Y Outlook 2013 Run A Script Outlook VBA and Custom Forms 4
O Outlook 2016 This rule will only run when you check your email in Outlook.... Using Outlook 4
B run scripts Using Outlook 1
A Run time error 424. object required in outlook 2013 Outlook VBA and Custom Forms 10
Dave A Run macro on existing appointment when it changes Outlook VBA and Custom Forms 1
O Run macro automatically at sending an email Using Outlook 11
P errors appear every time I run SCANPST Using Outlook 3
B Outlook rule run a Script doesn't work Outlook VBA and Custom Forms 1
S VBA Macro - Run-time error '424': object required - Help Please Outlook VBA and Custom Forms 3
B Wanting to run a script that will filter any body that has a russian link in it. Outlook VBA and Custom Forms 5
P Run Time Error 91 when linking contact to task in VBA Outlook VBA and Custom Forms 1
O Having rules run on old mails noved to inbox Outlook VBA and Custom Forms 8
Bri the Tech Guy Registry Tweak to make "Run a Script" Action Available Outlook VBA and Custom Forms 2
Bri the Tech Guy Run Script rule not running for newly arriving messages Outlook VBA and Custom Forms 25
J Custom form code doesn't run Outlook VBA and Custom Forms 2
J VBA Run When Reply Outlook VBA and Custom Forms 4
Vijay Error in rule- Run a script Using Outlook 1
Vijay Run script doesn't work in outlook Using Outlook 1
O VBA to Run Font Change on Outlook Startup Outlook VBA and Custom Forms 4
D Creating an outlook session from Access vba but run silently. With A specific profile Outlook VBA and Custom Forms 1
Diane Poremsky Run a Script Rule: Send a New Message when a Message Arrives Using Outlook 2
Diane Poremsky Using Scanpst in Outlook Click to Run Using Outlook 0
oliv- How to Run a Script IN AN ADDIN with Outlook's Rules and Alerts Outlook VBA and Custom Forms 2
L Run a Script Rule doesn't work Using Outlook 5
B Can't run macro from QAT when emailing from Acrobat Outlook VBA and Custom Forms 0
J Outlook 2010 VBScript editor does not run code at all Outlook VBA and Custom Forms 0
X Outlook script to run excel data Outlook VBA and Custom Forms 1
D How to Run a Report Based on Age of Inbox Items Outlook VBA and Custom Forms 0
D RUN SCRIPT WHEN OUTLOOK IS CLOSE Outlook VBA and Custom Forms 1
L Cannot run script from rule Outlook VBA and Custom Forms 7
M Office 365 Click to run BCM (Business Contact Manager) 0
O modify vba to run it as script rule Outlook VBA and Custom Forms 8
D Must now "View on Facebook" for Mentions/Comments-Outlook 2013 click-to-run Using Outlook 2
P How many subs can run in one outlook VBA script Using Outlook 5
R Outlook won't run except in Safe mode problem Using Outlook 5
K Revert AutoArchive settings via GPO (Run Autoarchive every...) Using Outlook 4
Xueying run a script in rules, first time succeed, failed afterwards Outlook VBA and Custom Forms 3

Similar threads

Top