Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Run a .exe file from an ASP intranet page

Posted on 2010-11-18
9
Medium Priority
?
845 Views
Last Modified: 2012-05-10
Hi,
On my intranet ASP site, I would like the code required to run an .exe file located on the client side local drive (c:\Program Files) on a new window. Is there a way to do this bypassing the download/save alerts?
Thanks,
Robert
0
Comment
Question by:Roberth509
[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
  • 5
  • 4
9 Comments
 
LVL 7

Expert Comment

by:Ironhoofs
ID: 34162821
Because this is what any virus would love to do, a lot of functionality  to do this has been removed. However, if you register a protocol on the local computer  you can call its target directly from your HTML page.

To test this, first double click the myprog.reg file. This will register a protocol that points to notepad.exe. Then open myprog.html in your browser to check if it worked.




 myprog.html
myprog.reg
0
 

Author Comment

by:Roberth509
ID: 34162931
The test worked fine...

a) What should I edit if say my .exe is in c:\Program Files\winamp\winamp.exe (just an example)?

b) Would I have to run myprog.reg on all computers?

Thanks
0
 
LVL 7

Expert Comment

by:Ironhoofs
ID: 34164397
To run the program of your choice, change "notepad.exe" inside the myprog.reg file .Unfortunatly, you have to run this once for each workstation.

By installing the protocol a user essentially gives you permission to do the actions you defined. Therefore this is (in my opinion) a decent solution for intranet sites, but unrealistic for public websites.

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Roberth509
ID: 34166070
ok...one last point:  how do I deal with the spaces of my folder name (Arquivos de Programas) in your file. Do I simply replace them with 20%?
0
 

Author Comment

by:Roberth509
ID: 34166077
Sorry ...I meant %20...
0
 
LVL 7

Expert Comment

by:Ironhoofs
ID: 34171460
To handle the problem of spaces in a file- or pathname, use the windows default and enclose the full path in quotation marks ("C:\Program Files\winamp\winamp.exe").

The reg file uses default C notation, therefore all special characters should be preceded by a "\".
The entry in the reg file would therefor look like:

[HKEY_CLASSES_ROOT\MYPROG\shell\open\command]
@="\"C:\\Program Files\\winamp\\winamp.exe\""

0
 
LVL 7

Expert Comment

by:Ironhoofs
ID: 34171523
One more tip: its possible to pass parameters to the protocol. Unfortunatly, i could only get that to work with a additional program.

To add a parameter you would change the  regfile to:

[HKEY_CLASSES_ROOT\MYPROG\shell\open\command]
@="\"C:\\Program Files\\winamp\\winamp.exe\" %1"

And you would change the HTML file to:

<a href="MYPROG:c:\mymusiclib\nicemusic.mp3"> Play some nice music</a>

The problem is that the value of the parameter includes the protocol name. The result of clicking the link is that winamp.exe is called with "MYPROG:c:\mymusiclib\nicemusic.mp3" as parameter and will not be able to find that file.

I used a workaround by pointing the regfile to my own program, stripping the parameter and launching the final program with the correct data. This way you can allso add some security by encrypting/decrypting the passed data.
0
 

Accepted Solution

by:
Roberth509 earned 0 total points
ID: 34202331
This is the solution I ended up using...it also works for .exe files:

<script type="text/javascript">
var saprisco = 'file://C:/Projetos Primavera/saprisco.xls'.replace(/ /g,' ');

function Run(commandtoRun, commandParms) {
  var oShell = new ActiveXObject("Shell.Application");
  oShell.ShellExecute(commandtoRun, commandParms, "", "open", "1");
  return false;
}
</script>
<a href="#" onclick="return Run('excel.exe',saprisco)">Click here</a>
0
 

Author Closing Comment

by:Roberth509
ID: 34224743
IMy solution does not involve having to set up any machine beforhand...
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The viewer will learn how to count occurrences of each item in an array.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

610 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