Results 1 to 6 of 6

Thread: Executing Shell in ASP

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    3

    Executing Shell in ASP

    I have this code in my asp

    Dim oShell
    Set oShell = CreateObject ("WScript.shell")
    oShell.run "%comspec% /c notepad"
    Set oShell = Nothing

    It runs the notepad in the task list, but not appearing in the desktop for user interaction.

    I have set the asp folder to full control for IUSR and IWAM users. And also full control to these 2 users for notepad.
    The asp folder has also been set to Scripts/Executable.
    Anything I have left out?

    I am using Windows Server 2003, IIS 6
    Anyone can help me to solve the problem?

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Trying changing the line to :

    Code:
    oShell.run ("%comspec% /c notepad", 1, True)
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    3

    Unhappy

    After changing, it gives the following error. Do you have any suggestions?


    Microsoft VBScript compilation error '800a0414'

    Cannot use parentheses when calling a Sub

    /LVB_Elaine/testshell.asp, line 17

    oShell.run ("%comspec% /c notepad", 1, true)
    --------------------------------------------^

  4. #4
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by et20
    After changing, it gives the following error. Do you have any suggestions?


    Microsoft VBScript compilation error '800a0414'

    Cannot use parentheses when calling a Sub

    /LVB_Elaine/testshell.asp, line 17

    oShell.run ("%comspec% /c notepad", 1, true)
    --------------------------------------------^
    Oops sorry, take out the two brackets

    oShell.run "%comspec% /c notepad", 1, true
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2004
    Posts
    3
    The asp page seems hanged after I change the code.
    I can see the program has been executed in the task list, but not in desktop.

  6. #6
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877
    Originally posted by et20
    The asp page seems hanged after I change the code.
    I can see the program has been executed in the task list, but not in desktop.
    Hmm, its supposted to open the notepad, and wait for user to type and close the notepad.

    I tried it and having the same problem as you, i even tried calling a batch file and getting the batch file to execute the notepad with no luckh. Not sure where the problem is.

    For more info on Run command chec this MS link http://msdn.microsoft.com/library/de...l/wsmthrun.asp
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width