Link to home
Start Free TrialLog in
Avatar of cbonjovi
cbonjovi

asked on

Execute an .exe application from .asp page

I'd to launch an .exe application from my asp page.
What have I do?
Does the System VB command exist?
Regards
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Do you want the .exe to launch on the server or client side? My understanding is that you cannot automatically launch an .exe on the client side unless the user clicks on the link and then either executes or downloads the .exe.

You can launch server-side .exe's, but I am not sure what it is that you want to do exactly.

Fritz the Blank
Avatar of robbert
robbert

a) Set objShell = CreateObject("WScript.Shell")
objShell.Run "c:\myFile.exe"

Regarding security issues (the command will be executed either in the context of user SYSTEM or IUSR_MACHINENAME or whoever has logged on) see:
INFO: The Run Method of the Wscript.shell Object Executes Commands in System Context in IIS
http://support.microsoft.com/support/kb/articles/Q278/3/19.ASP

b) Free AspExec component: www.serverobjects.com/products.htm#free

-- If there are further questions, ask.
If you want to wait until the exe application finished, you make need to use API call within an activeX COM to execute the executable.

Avatar of cbonjovi

ASKER

With:
objShell.Run "c:\inetpub\wwwroot\notepad.exe"
application doesn't start.
What have I to set?
At the client or at the server side?
I want to launch an application on server side
ASKER CERTIFIED SOLUTION
Avatar of robbert
robbert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK, found notepad in TaskManager.
Now my aim is to quit notepad from asp script.
Is there a WScript.Shell method?
I cant quit notpad in any way, neither in Task Manager!
Notepad isn't meant and built to be executed from web services -- it's a desktop application. -- You can kill it either after stopping the IISAdmin service or rebooting. -- Forget running Notepad that way, and rather tell us in non-technical terms what you'ld like to achieve.
OK, I see.
My aim is control start&kill an application (.exe) from an .asp page. This application is completly separated and asp has not to wait for it, only launch it and, in any other time, be able to kill it (my idea was to record the pid in a txt file and use it to kill...)
That's all.
There are limits with apps that have user interfaces, as you have experienced.
To kill an application you would write your own VB DLL. There might be additional issues in security, and probably, you would put that DLL into a COM+ package, to run under in admin's security context.
If you wanted to go through that I could grab some sample code and introduce you to COM+ security concepts, but...
I'd prefer not using VB DLL component.
My app doesn't have a user interface, but is a sort of daemon (is a console apllication that run an H.323 listener!)
Hi robbert ,

Would you by chance know how to put the run line below into a clickable link?

Set objShell = CreateObject("WScript.Shell")
                        objShell.Run "c:\myFile.exe"

Thanks,

Gary
I don't believe that you can; the vbscript runs server side while the clickable link takes place on the client. So even if you code the above as a link, it will return an error. You can, however, link to a new page (or refresh the current one) in such a way to run the code server side.

Fritz the Blank
Hi Fritz the Blank,

Could we please take this question to
https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=asp&qid=20281459

I don't own this question ID and I would like to be able to give you the points if you find an answer for me.
I do own the referenced question ID.

Thanks,

Gary

PS:  I will reply to this in the other question.
So, where are we with this?

Please close this question out by accepting the comment that helped you the most as an answer.

Fritz the Blank
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept a comment - robbert
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
lavinder
EE Cleanup Volunteer
That sounds good to me,

Fritz the Blank