create Shell Object hangs

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nico

    #1

    create Shell Object hangs

    I try to execute a shell command from ASP with:

    response.write( "start")
    Set wshShell = CreateObject("W Script.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?
  • Bob Barrows

    #2
    Re: create Shell Object hangs

    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.v bscript or jscript.

    HTH,
    Bob Barrows

    Nico wrote:[color=blue]
    > I try to execute a shell command from ASP with:
    >
    > response.write( "start")
    > Set wshShell = CreateObject("W Script.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?[/color]



    Comment

    • Bob Barrows

      #3
      Re: create Shell Object hangs

      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:[color=blue]
      > 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![/color]


      Comment

      • Ramasamy_rams
        New Member
        • Sep 2005
        • 1

        #4
        Calling Exe in client using ASp.Net

        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("W Script.Shell")
        WshShell.Run("C :\temp\exeuploa d.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@gmai l.com
        Rams

        Comment

        Working...