?
Solved

Passing Parameters thrrough and HTML link to an .exe

Posted on 2007-11-16
11
Medium Priority
?
496 Views
Last Modified: 2008-02-01
How do I create an link that passes parameters to an .exe?

Pretty much I needed to give my users a link that has the password ingrained in it already.
0
Comment
Question by:z018196
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 20300001
Hi, z018196.

Create a script or command file that launches the exe and passes whatever information it requires.  Link to the script/command file.
0
 

Author Comment

by:z018196
ID: 20300022
The only problem is that I'd need a seperate script/command-file for each user... I was hoping only to have to make a unique link.  Is there any coding I can embed in the link?
0
 
LVL 76

Expert Comment

by:David Lee
ID: 20301683
> I'd need a seperate script/command-file for each user
Perhaps, but not necessarily.  You could retrieve the username in the script and use a CASE or IF ... THEN sequence to get the right password.  Something like this:

    Set WshProcessEnvironment = WshShell.Environment("Process")
    varUsername = wshProcessEnvironment.Item("UserName")
    Select Case varUsername
        Case "Username1"
            varPassword = "PasswordA"
        Case "Username2"
            varPassword = "PasswordB"
    End Select
    Set objShell = WScript.CreateObject("WScript.Shell")
    objShell.Run "C:\Somepath\MyExecutable.exe " & varPassword
0
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 

Author Comment

by:z018196
ID: 20312655
I don't know if that will work in my case though.  Think of it like this.  I have a database(table) with a bunch of records and each of them has a unique identifier.  I was hoping I could send out an email, when a record is created, that would have the unique Id for that record included.  When the link was pushed, a report would get generated for that record.  I can create a VB.Net app that just asks for the unique ID but I was hoping to embed it into the link so that people couldn't just enter in any number.  Does that make sense?
0
 
LVL 76

Expert Comment

by:David Lee
ID: 20313239
Sure.  All you need to do is send a link with a parameter.  Something like

    http://company.com/somepage.aspx?id=UniqueID
0
 

Author Comment

by:z018196
ID: 20313455
how to capture that parameter?  Below is my code... can you tell me what I'm missing?  I can access the application correctly, which is good, now I just need to capture the parameter.
 
link in email:
file:///C:\Misc\App\App\bin\Release\App.exe?id=52
 
code in executable:
Dim str as String
Dim param as Integer
 
For Each str in Environment.GetCommandLineArgs()
    param = str  
Next
 
I don't think the GetCommandLineAgrs() is correct.
 
Thanks,
0
 
LVL 76

Accepted Solution

by:
David Lee earned 1500 total points
ID: 20313516
Here's a page that describes how to format and retrieve command line parameters from a VB.net application.

http://www.devx.com/dotnet/Article/10115/1954?pf=true
0
 

Author Comment

by:z018196
ID: 20314928
I took a look at the article but couldn't find what I needed.  I can't get the GetCommandLineAgrs() to work right.  It doesn't get the parameter I pass to it, just the link to the executable.

Any suggestions?
0
 
LVL 76

Expert Comment

by:David Lee
ID: 20315096
Please show me the link that you're using.
0
 

Author Comment

by:z018196
ID: 20363326
file:///C:\Misc\App\bin\Release\App.exe?id=52    
0
 
LVL 76

Expert Comment

by:David Lee
ID: 20384172
Try this instead

    file:///C:\Misc\App\bin\Release\App.exe%2052

or

    file:///C:\Misc\App\bin\Release\App.exe%20-id%2052

Look back at that article I linked to and check the section titled "Generic Parsing Guidelines".
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you have clients or friends from around the world, it becomes a challenge to arrange a meeting or effectively manage your time. This is where Outlook's capability to show 2 time zones in one calendar comes in handy.
If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question