[XPOST] Controlling the commandline via ASP/WSH

Discussion in 'ASP General' started by Lorenzo Bolognini, Aug 15, 2003.

  1. Hi all,

    I have a problem letting this small script I wrote work correctly. In
    particular i can't manage to execute commands that require user
    input/confirmation. How should i handle that?

    If you are going to try it i suggest you to start passing it a simple "dir
    c:\"

    Thank you,
    Lorenzo Bolognini

    -------------------------------
    place it in a file called wcl.asp
    -------------------------------
    <%
    'THIS SOFTWARE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND
    'EVEN EXPRESS OR IMPLIED.
    %>
    <html>
    <head>
    <title>WebCommandLine</title>
    </head>
    <body>
    <%
    action = Request.Querystring("action")
    Select Case action
    Case ""
    %>
    <form action="wcl.asp?action=exe" method="post">
    <code>C:\></code> <input type="text" name="command" size="100">
    <input type="submit">
    <input type="reset">
    </form>
    <%
    Case "exe"
    command = Request.Form("command")
    Set WshShell = Server.CreateObject("WScript.Shell")
    'could put the log on the ftp dir so it could be downloadable
    WshShell.Run("cmd.exe /K " & command & " > C:\CHANGE_THIS_NAME.log")
    Set WshShell = Nothing
    Response.Write("Command: <font color=red>" & command & "</font>
    executed! " & _
    "<br>Thanks for having used WebCommandLine!<br>" & _
    "<a href='wcl.asp'>New Command</a>")

    End Select
    %>

    </body>
    </html>
     
    Lorenzo Bolognini, Aug 15, 2003
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris
    Replies:
    3
    Views:
    1,425
    Chris
    Sep 10, 2003
  2. Chris

    Embedded Perl or Python (XPost)

    Chris, Sep 5, 2003, in forum: Python
    Replies:
    9
    Views:
    460
    Chris
    Sep 10, 2003
  3. stefanogaburri
    Replies:
    12
    Views:
    962
    jsimha_makineni
    Feb 8, 2004
  4. kyiu

    lost in ASP & WSH!please help!

    kyiu, Jul 11, 2003, in forum: ASP General
    Replies:
    1
    Views:
    219
    Dhananjay Modak
    Jul 11, 2003
  5. Karen

    client-side WSH in ASP

    Karen, Jul 21, 2003, in forum: ASP General
    Replies:
    0
    Views:
    193
    Karen
    Jul 21, 2003
  6. ben h

    Can I call a WSH from ASP?

    ben h, Jul 8, 2004, in forum: ASP General
    Replies:
    1
    Views:
    161
    Michael Harris \(MVP\)
    Jul 8, 2004
  7. Bob

    Calling WSH scripts from ASP

    Bob, Jun 19, 2006, in forum: ASP General
    Replies:
    3
    Views:
    312
  8. IanW
    Replies:
    23
    Views:
    1,517
Loading...