SoFunction
Updated on 2025-03-06

Methods to implicitly run CMD command line windows in C#


using System;
using ;
namespace Business
{
/// <summary>
/// Command's summary description.
/// </summary>
public class Command
{
private Process proc = null;
/// <summary>
/// Construct method
/// </summary>
public Command()
{
proc = new Process();
}
/// <summary>
/// Execute CMD statement
/// </summary>
/// <param name="cmd">CMD command to be executed</param>
public void RunCmd(string cmd)
{
= true;
= "";
= false;
= true;
= true;
= true;
();
(cmd);
();
}
/// <summary>
/// Open the software and execute the command
/// </summary>
/// <param name="programName">Software path plus name (.exe file)</param>
/// <param name="cmd">Command to be executed</param>
public void RunProgram(string programName,string cmd)
{
Process proc = new Process();
= true;
= programName;
= false;
= true;
= true;
= true;
();
if ( != 0)
{
(cmd);
}
();
}
/// <summary>
/// Open the software
/// </summary>
/// <param name="programName">Software path plus name (.exe file)</param>
public void RunProgram(string programName)
{
(programName,"");
}
}
}