469,921 Members | 2,212 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,921 developers. It's quick & easy.

create Shell Object hangs

I try to execute a shell command from ASP with:

response.write("start")
Set wshShell = CreateObject("WScript.Shell")
wshShell.Run "notepad"
Set wshShell = Nothing
response.write("finished")

but it doesn't work, there is no error message, the page just displays
nothing. I tried various commands like "mkdir test" or calling a batch
file, always with the same result. When I just create the object, but
don't run a command the page is displayed without error messages.

Any ideas?
Jul 19 '05 #1
3 6389
You can't shell to a program that uses a user interface from server-side
code. Think about it: who is going to be sitting at the server's monitor to
work with and close these notepad windows ...?

If you want something to be called on the user's machine, then you need to
be thinking about client-side code. Just be aware that there are security
issues involved with client-side code as well. Would you want to navigate to
a web page that used client-side code to launch a potentially dangerous
program (format c:) on your machine?

You will need to investigate hta (html applications) and move followups to
this discussion to a client-side script newsgroup such as
m.p.scripting.vbscript or jscript.

HTH,
Bob Barrows

Nico wrote:
I try to execute a shell command from ASP with:

response.write("start")
Set wshShell = CreateObject("WScript.Shell")
wshShell.Run "notepad"
Set wshShell = Nothing
response.write("finished")

but it doesn't work, there is no error message, the page just displays
nothing. I tried various commands like "mkdir test" or calling a batch
file, always with the same result. When I just create the object, but
don't run a command the page is displayed without error messages.

Any ideas?


Jul 19 '05 #2
I read somewhere that it is possible to use Java objects in asp, but I never
really looked into it. I suggest you do a search at msdn.microsoft.com or
via google to get further information.

Bob Barrows

Nico de Haen wrote:
Thank you Bob for your answer.

I understand the problem with the user interface, I just tried
notepad, since I found it in an example script. What I want to do at
least, is to call a Java class from ASP. Since
getObject("java:myClass") doesn't work, I want to try it with a shell
command. But I can't even get the WSHshell to work. The commands I
tried, were just for testing. I'm not shure, but for example the
mkdir-command should work, if I give writing permits in the directory.

I'm more experienced with JSP and PHP and it would be nice to use Java
with ASP, since then I have much more possibilities. (like using
XSLT-FO for creating PDF-files etc.)

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #3
Hi,
How to call exe file from client machine using asp.net code...
I had some code but this code is Executed in server itself and that too cant view...

Dim WshShell
WshShell = CreateObject("WScript.Shell")
WshShell.Run("C:\temp\exeupload.exe")
WshShell = Nothing

Can u please provide a code for calling a client exe through asp.net page..

Thanks in advance..
If had some suggestion please send it to ramasamy.p@gmail.com
Rams
Sep 14 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Oliver Gräser | last post: by
7 posts views Thread by martins | last post: by
4 posts views Thread by emin.shopper | last post: by
4 posts views Thread by gwise | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.