RUN/execute a Command-Line command from an ASP page

Discussion in 'ASP .Net Building Controls' started by Lucas Cowald, Oct 22, 2003.

  1. Lucas Cowald

    Lucas Cowald Guest

    Hi,
    I need to RUN/execute a Command-Line command from an ASP page.

    This is the command:
    sse45.exe -i k:\o\2.wmv -o k:\o\2.shh -w 128 -df 0 -m 2 -p

    Can you show me a code how to run this command from an ASP page? I need to
    run it from an ASP/VBscript?

    Thank you very much for your help!
     
    Lucas Cowald, Oct 22, 2003
    #1
    1. Advertising

  2. Lucas Cowald

    Genich Guest

    <%@ Language=VBScript %>
    <%
    ' --------------------o0o--------------------
    ' File: CmdAsp.asp
    ' Author: Maceo <maceo @ dogmile.com>
    ' Release: 2000-12-01
    ' OS: Windows 2000, 4.0 NT
    ' -------------------------------------------

    Dim oScript
    Dim oScriptNet
    Dim oFileSys, oFile
    Dim szCMD, szTempFile

    On Error Resume Next

    ' -- create the COM objects that we will be using -- '
    Set oScript = Server.CreateObject("WSCRIPT.SHELL")
    Set oScriptNet = Server.CreateObject("WSCRIPT.NETWORK")
    Set oFileSys = Server.CreateObject("Scripting.FileSystemObject")

    ' -- check for a command that we have posted -- '
    szCMD = Request.Form(".CMD")
    If (szCMD <> "") Then

    ' -- Use a poor man's pipe ... a temp file -- '
    szTempFile = "C:\" & oFileSys.GetTempName( )
    Call oScript.Run ("cmd.exe /c " & szCMD & " > " & szTempFile, 0, True)
    Set oFile = oFileSys.OpenTextFile (szTempFile, 1, False, 0)

    End If

    %>
    <HTML>
    <BODY>
    <FORM action="<%= Request.ServerVariables("URL") %>" method="POST">
    <input type=text name=".CMD" size=45 value="<%= szCMD %>">
    <input type=submit value="Run">
    </FORM>
    <PRE><%= "\\" & oScriptNet.ComputerName & "\" & oScriptNet.UserName %>
    <br>
    <%
    If (IsObject(oFile)) Then
    ' -- Read the output from our command and remove the temp file -- '
    On Error Resume Next
    Response.Write Server.HTMLEncode(oFile.ReadAll)
    oFile.Close
    Call oFileSys.DeleteFile(szTempFile, True)
    End If
    %>
    </BODY></HTML>


    "Lucas Cowald" <> wrote in message
    news:...
    > Hi,
    > I need to RUN/execute a Command-Line command from an ASP page.
    >
    > This is the command:
    > sse45.exe -i k:\o\2.wmv -o k:\o\2.shh -w 128 -df 0 -m 2 -p
    >
    > Can you show me a code how to run this command from an ASP page? I need to
    > run it from an ASP/VBscript?
    >
    > Thank you very much for your help!
    >
    >
     
    Genich, Oct 22, 2003
    #2
    1. Advertising

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. Lucas Cowald
    Replies:
    4
    Views:
    1,139
    Tohid
    Oct 23, 2003
  2. Lucas Cowald

    RUN/execute a Command-Line command from an ASP page.

    Lucas Cowald, Oct 22, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    242
    Oliver
    Oct 22, 2003
  3. Lucas Cowald

    RUN/execute a Command-Line command from an ASP page.

    Lucas Cowald, Oct 22, 2003, in forum: ASP .Net Mobile
    Replies:
    0
    Views:
    208
    Lucas Cowald
    Oct 22, 2003
  4. Lucas Cowald

    RUN/execute a Command-Line command from an ASP page.

    Lucas Cowald, Oct 22, 2003, in forum: ASP .Net Security
    Replies:
    0
    Views:
    259
    Lucas Cowald
    Oct 22, 2003
  5. Lucas Cowald

    RUN/execute a Command-Line command from an ASP page.

    Lucas Cowald, Oct 22, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    174
    Lucas Cowald
    Oct 22, 2003
Loading...

Share This Page