Solved

shell.run hangs

Posted on 2004-08-20
5
1,053 Views
Last Modified: 2010-08-05
Hi
I am trying to run regsvr32.exe from an ASP code using WScript Shell object with such code:

<%
Dim wshell, intReturn
set wshell = server.createobject("wscript.shell")
intReturn = wshell.run("%comspec% /c regsvr32 /u ""C:\Documents and Settings\Hojjat\Desktop\shell.wsc"" ", 0, True)
Response.Write( intReturn )
set wshell = nothing
%>

Looking to my task manager, I see that IWAM user on my computer openes cmd and regsvr32 programs, but it failes to unregister the component.
When I run this sample code to open Notepad:

<%
Dim wshell, intReturn
set wshell = server.createobject("wscript.shell")
intReturn = wshell.run("%comspec% /c notepad.exe", 0, True)
Response.Write( intReturn )
set wshell = nothing
%>

It not only does not open notepad, but also hangs running the code. I don't know how to finish the procedure or close notepad.exe myself.

Why does the code hang on running regsvr32, notepad.exe etc? Notice that IUSR user has the permission to read and execute regsvr32 and notepad.exe on my machine.

Huji
0
Comment
Question by:huji
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:wesbird
ID: 11850864
if would be a good idea to include the /s option to regsvr32 to prevent it from opening a mesage box on the desktop of the process - which is probably invisible unless you're logged on interactively as IUSR_...
0
 
LVL 7

Accepted Solution

by:
wesbird earned 500 total points
ID: 11850911
I meant to say "window station" of the process.  See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/window_stations.asp.

Your code is not hanging, merely being displayed on a window station that you cannot see because it is not interactive.
0
 
LVL 14

Author Comment

by:huji
ID: 11852069
Well, hang problem is solved by now, but the code is not acting indeed. It returns 5 to me, which I don't know what it means, but I know it is different from normal 0 or 1 values I have recieved from a Run command.
Do you know why it is not acting? And by the way, can I register components this way? For example upload a DLL to my root directory, then install it running regsvr32 through ASP?
Huji
0
 
LVL 14

Author Comment

by:huji
ID: 11865374
Please pay attention to this question:
http:Q_21101268.html
Huji
0
 
LVL 7

Expert Comment

by:wesbird
ID: 12519956
PS for any late readers on this thread.. 5 usually means access denied.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Query not working correctly? (or how i want it to... 6 52
FileUp - Classic ASP 5 19
Weighted Randomizing 6 30
html Uncheck Checkbox 2 25
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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

856 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