[FLUG] Fw: [XPOST] Controlling the commandline via ASP/WSH

  • From: "Lorenzo Bolognini" <lorenzo@xxxxxxxxxxxxx>
  • To: "fanolug" <fanolug@xxxxxxxxxxxxx>
  • Date: Sun, 17 Aug 2003 04:04:09 +0200

Mailing List del Fortunae LUG
=============================

Ciao ragazzi,

vi forwardo un problema che ho postato xpostato su 2 ng MS e che non
ha avuto soluzione... ovvero, non me l'hanno voluta dare!!

Ciao,
Lo

----- Original Message ----- 
From: "Lorenzo Bolognini" <lorenzo@xxxxxxxxxxxxx>
Newsgroups:
microsoft.public.inetserver.asp.general,microsoft.public.scripting.wsh
Sent: Friday, August 15, 2003 2:27 PM
Subject: [XPOST] Controlling the commandline via ASP/WSH


> 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>
>
>

-- 
«Just in terms of allocation of time resources, religion is not very efficient. 
There's a lot more I could be doing on a Sunday morning.» Bill Gates

Other related posts:

  • » [FLUG] Fw: [XPOST] Controlling the commandline via ASP/WSH