[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Running a C++ exe in asp with parameters

Posted on 2009-12-21
13
Medium Priority
?
375 Views
Last Modified: 2012-05-08
Team,

I have a C++ Exe which needs 4 parameters(4 txt files). how do i run the same in asp?

running the EXE (with 4 txt files as parameters).
0
Comment
Question by:storage_expert
  • 7
  • 6
13 Comments
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 26095749
?
Do you want to launch the exe from a button (or some other way) ?
Do you want the asp to behave the same way ?
0
 
LVL 1

Author Comment

by:storage_expert
ID: 26095776
ok.., long story short.., i have 2 stored procs & 1 exe.., stored procs( pre - exe & post Exe).
1st pre-exe stored proc runs in asp and it results 2 txt files
and then once its done, i need to call this exe with 4 txt files as parameters
and then need to run the post exe stored procs..,

need to have a code to run that exe with 4 txt files as parameters
0
 
LVL 1

Author Comment

by:storage_expert
ID: 26103933
help me pls.., its urgent.
0
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.

 
LVL 45

Expert Comment

by:AndyAinscow
ID: 26104092
I'm not an asp expert, I think the following should work calling file.exe with 4 text files as parameters (a..d)

<%
    set wshell = server.createobject("wscript.shell")
    wshell.run "c:\\file.exe c:\\a.txt C:\\b.txt c:\\c.txt c:\\d.txt"
    set wshell = nothing
%>
0
 
LVL 1

Author Comment

by:storage_expert
ID: 26104597
sorry.., this didnt work..,
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 26104637
Any error message ?
0
 
LVL 1

Author Comment

by:storage_expert
ID: 26104720
4th txt file should be the result of the exe with 3 parameters but looks like the exe is not running & so the 4th file is not getting created. i checked in command prompt n it does create the 4th file.
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 26104759
Are there any spaces in the paths you supply ?
0
 
LVL 1

Author Comment

by:storage_expert
ID: 26104797
What i did is, i have assigned value to user and then called the exe with following code.


user = "AB_CD"
eval = "C:\Inetpub\Wwwroot\MO\Evalconfig_" & user & ".txt "
max = "C:\Inetpub\Wwwroot\MO\Maxprice_" & user & ".txt "
dummy = "C:\Inetpub\Wwwroot\MO\Dummy.txt "
recom = "C:\Inetpub\Wwwroot\MO\Recommendations_" & user & ".txt "

path =  "C:\Inetpub\Wwwroot\MO\Evalconfigurator.exe "


 set wshell = server.createobject("wscript.shell")
    wshell.exec "path eval dummy max recom"
    set wshell = nothing

now error code:

 WshShell.Exec (0x80070002)
The system cannot find the file specified.
/MO/ProcessConfig.asp, line 101
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 26104833
wshell.exec "path eval dummy max recom"

doesn't the " " result in a string literal not the variable contents as you want?
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 26104853
At least it gives an error message - so the wshell.exec seems to be running in your earlier attempt.

Can you write apps yourself?  (Thinks - write a dummy app that just dumps the params supplied to a file, see if the app is getting what you think is being supplied)
0
 
LVL 1

Author Comment

by:storage_expert
ID: 26111192
sorry.., i didnt understand what you meant by write a app.., am not expert.., pls bare with me.
0
 
LVL 45

Accepted Solution

by:
AndyAinscow earned 2000 total points
ID: 26111281
I meant just put a small exe file together yourself, all it would do would be to dump the arguments supplied into a file (hardcoded, eg. C:\\params.txt) so you could check that it was being started and the list of files you passed was correct.

Do you have visual studio or visual C at your end?  (If yes then I can throw a few lines of C code together for you).

(I know the C++ side of things, asp knowledge is much more limited).
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview
Suggested Courses

830 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