?
Solved

Run EXE on the server from a ASP program

Posted on 2001-08-23
7
Medium Priority
?
298 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
[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
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
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 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:Silvers5
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

770 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