SoFunction
Updated on 2025-03-09

Implementation code for executing cmd command


using System;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
using ;
namespace WebForm
{
public partial class _Default :
{
protected void Page_Load(object sender, EventArgs e)
{
(ExeCommand("ping "));
}
public string ExeCommand(string commandText)
{
Process p = new Process();
= "";
= false;
= true;
= true;
= true;
= true;
string strOutput = null;
try
{
();
(commandText);
("exit");
strOutput = ();
();
();
}
catch (Exception e)
{
strOutput = ;
}
return strOutput;
}
}
}