Solved

Run EXE on the server from a ASP program

Posted on 2001-08-23
7
296 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 5

Accepted Solution

by:
raizon earned 50 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

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…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

688 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