?
Solved

Run EXE on the server from a ASP program

Posted on 2001-08-23
7
Medium Priority
?
302 Views
Last Modified: 2007-12-19
Hi,
I need to compile a C program from ASP using the turbo c editor. For doing this I have to invoke the turboc exe with the filename as a parameter. I am using code something like

set wsh=Server.createobject("wscript.shell")
wsh.run("cmd /c d:\tcc -l glob.c")

NOTE: here glob.c is the file which i am trying to compile.
when i run this ASP script its not giving any error and also its not working. What might be the possible problem.
For doing this I have referred MSDN, in that I got code something like :
  Set WshShell = Wscript.CreateObject("Wscript.Shell")
  WshShell.Run ("notepad.exe")
When i try to run this script its giving run time error as
"object required at WScript.CreateObject line. So in my code I have changed WScript.createobject to server.createobject but then also its not working.
Please help me out.
0
Comment
Question by:raghu_hale
7 Comments
 
LVL 8

Expert Comment

by:drittich
ID: 6417313
0
 
LVL 5

Expert Comment

by:raizon
ID: 6417330
This isn't something that can run from serverside code.  It must be ran from client side code.  Therefore it needs to be in script tags and createobject rather than server.createobject.

<script language='VBScript'>
set wsh = CreateObject("wscript.shell")
wsh.run("cmd /c d:\tcc -l glob.c")
</script>
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 6418549
You can run Wsh from the server.
BTW, what is your OS?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Accepted Solution

by:
raizon earned 200 total points
ID: 6418817
AzraSound,

I'm testing this on my localsystem running W2K Pro.

Using the code below opens up the system.ini but not the win.ini.  I have a scenario where running the wsh from the server would be helpful but have been unsuccessful thus far.


<%
Set wsh = Server.CreateObject("Wscript.Shell")
wsh.Run("notepad.exe C:\winnt\win.ini")
Set wsh = Nothing
%>
<html>
<head>
<script language="vbScript">

Set wScript = CreateObject("Wscript.Shell")
wScript.Run("notepad.exe C:\winnt\system.ini")

</script>
</head>
<body>
</body>
</html>
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 6418988
Try setting the windowstyle for Notepad in the Run method.  Also, the Run method returns an error code value, so check that also to see if you are getting an error returned.  Theres a chance you are running notepad, just invisibly (might wanna check your task list).

For documentation:
http://msdn.microsoft.com/scripting/default.htm?/scripting/windowshost/doc/wsMthRun.htm
0
 
LVL 20

Expert Comment

by:Michel Sakr
ID: 6418990
try aspexec from www.serverobjects.com  it's free and best way to do such things since for security and permission reasons you can't run effectively a command shell from asp..
0
 
LVL 5

Expert Comment

by:raizon
ID: 6419033
Thanks AzraSound, I didn't think of checking taskmanager, it was running invisibly.
0

Featured Post

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.

Question has a verified solution.

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

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Integration Management Part 2
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

862 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