Execute command window within asp

Need help using cmd to execute and display an application. I have tried Aspexec, but apparently in windows 2k sp5 it does not work, I can see the processes running in the background but can never get the actual application to display. I have allowed full access and made sure my services are enabled to interact with desktop. I've tried using Dynuexec but still know pop up of the actual application, at this point I'm just playing with a simple app like notepad. exe. What my application does is (and works) is takes a file then:
Set oWSH= Server.CreateObject("WScript.Shell")

oWSH.Run "c:\winnt\lame.exe -b 16 -m m c:\inetpub\wwwroot\wavfiles\song.wav c:\inetpub\wwwroot\mp3files\song.mp3", 1, True

set oWSH = nothing
The above script works great but does not show me the cmd window running the conversion. I see the process running in task manager.

Some other scripts I have tried

  Set Executor = Server.CreateObject("ASPExec.Execute")
  Executor.Application = "notepad.exe"
  Executor.Parameters = "c:\autoexec.bat"
  Executor.ShowWindow = True
  Response.Write "Attempting to execute " & Executor.Application & "<br>"
  strResult = Executor.ExecuteWinApp
  Response.Write "The result of this call was: " & strResult
did not open the window even after changing my setting in the services and using the internet guest acount with full access. I've tried changing the levels of security but nothing.

I've also tried:
  Set oExec = Server.CreateObject("Dynu.Exec")

  Response.Write(oExec.execute("nslookup -type=mx microsfot.com"))

  Set oExec = nothing
I want to execute the cmd window and watch the executable run the conversion of my files. Any help would really be appreciated as I have been working on this since very early this morning. I'm running win2k sp5 and this is going to be client side with personal web server set up etc..
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


The reason that you cannot see the executable running is because it is being launched by another user account. In this case, the IWAM. I tested a few methods of setting security levels and modifying the application package in COM+ to use the current user in order to see the executable as it is launched, but was unsuccessful.

If you really want to see the script running, your best be is to not run the script through an ASP page, but instead create a VBS or WSH file that you execute to perform the task. Since it is being launched from the desktop, you will then be able to see the external program running.

On another note, if the external program provides status messages along the way by way of updating the cmd window with output, you can read that information into your ASP page using not the Run method of the Shell object, but the Exec method and then access the StdOut properties... This is accessible if you have 5.5+ of Cscript installed on your machine (available from http://microsoft.com/scripting)

Here is an example using the Exe method:

Set oShell = Server.CreateObject("WScript.Shell")
Set oExec = oShell.Exec(sExecStr)
      tmpStr = oExec.StdOut.ReadAll()
Loop While Not oExec.Stdout.atEndOfStream
RetCode = oExec.stderr.readall

Here is some additional documentation on these methods:

Hope that this was able to help you!

- misty

Since it's only going to be used locally, you can use client side vbscript to perform the task.

<SCRIPT language="VBScript">
Set oWSH= CreateObject("WScript.Shell")

oWSH.Run "c:\winnt\lame.exe -b 16 -m m c:\inetpub\wwwroot\wavfiles\song.wav c:\inetpub\wwwroot\mp3files\song.mp3", 1, True

set oWSH = nothing

If you are using asp to populate the song names dynamically you can still do this by dynamically creating client side script, like this.

<SCRIPT language="VBScript">
Set oWSH= CreateObject("WScript.Shell")

oWSH.Run "c:\winnt\lame.exe -b 16 -m m c:\inetpub\wwwroot\wavfiles\<%=strSongName%>.wav c:\inetpub\wwwroot\mp3files\<%=strSongName%>.mp3", 1, True

set oWSH = nothing

swtlbeeAuthor Commented:
How do I prevent the file download windo from coming up when I execute the script in the browser.
CompTIA Network+

Prepare for the CompTIA Network+ exam by learning how to troubleshoot, configure, and manage both wired and wireless networks.

How are you calling the function.  Through a button, a hyperlink, or ?

Mike_Metro's answer is absolutely correct. As long as you are using IE, you can use the client-side VBScript to call the exe and view the output on the desktop.

Here is an example that will launch notepad.exe using a form button or a hyperlink.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<TITLE> Pop Exe </TITLE>

<SCRIPT language="VBScript" type="text/vbscript">

Function PopExe
      Dim oWSH

      Set oWSH= CreateObject("WScript.Shell")

      oWSH.Run "notepad.exe", 1, True

      set oWSH = nothing

End Function




      <input type="button" name="btnLaunch" onClick="PopExe" value="Launch Exe">

<a href="#" onClick="PopExe">Launch Exe</a>


- misty

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Is Wscript available on all windows platforms?
dear mistyrae
i am really very dipressed as i am unable to do the same task that is invoking an vb exe from client to pass one parameter...
i tried this code but the prob. is that it only runs process does not show any interface at server side...
can u please help me out otherwise i will mad..............
The problem I am having is this:
dim wsh
set wsh = CreateObject("wscript.shell")
wsh.run ("D:\....\prog.exe")
set wsh = nothing

This works fine on W2K professional and W2K Server.  I am unable to create the shell activeX object on XP Pro Service Pack 1.  I know all objects are registered becasue this same code executes just fine from a VB program or from vbs.  I just get the failure on an ASP page.
first of all Thanks for the answer but non of above dose not work,
 error: "object expected"

it does not know the shell object
what shall I do?

Does your anti-virus program has Script Blocking enabled?  Just a guess.

i am really very dipressed as i am unable to do the same task .
I want to call an exe from client machine...
 The following code is well calling an exe file from server not from client machine...

        Dim WshShell
        WshShell = CreateObject("WScript.Shell")
        WshShell = Nothing

i tried this code but the prob. is that it only runs process  does not show any interface at server side and what i expect is i need to run from client machine not from server...
can u please help me out ..............

thanks in advance...
if had some coding can u pls send it to


i executed this script

Dim oScheduler
Dim objTask
Dim objTrigger
Set oScheduler = CreateObject("Scheduler.SchedulingAgent.1")
Dim TaskName

Set objTask = oScheduler.Tasks.Add("CheckRegistrationReminder")
TaskName = "C:\WINNT\system32\wscript.exe """ & "C:\Program Files\NellieAdmin\" & "CheckRegistrationReminder.vbs """
objTask.ApplicationName = TaskName
objTask.Comment = "blah blah some comment"
objTask.Creator = "Script File"
objTask.WorkingDirectory = "C:\WINNT\system32"

the error said

Microsoft VBScript runtime  error '800a01ad'

ActiveX component can't create object: 'Scheduler.SchedulingAgent.1'

/schedtask.asp, line 5

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.