Run Dos command in Asp.Net applications

  • Thread starter Thread starter senthilmuruga
  • Start date Start date
S

senthilmuruga

Hi Everybody,

I have installed CVS which is a concurrent versioning system. I want to
execute the CVS commands (DOS based commands) from my Asp.Net
applications.

Anybody please tell me how to run CVS commands (Dos commands) from
Asp.Net!

Thanks in advance...
 
Checkout System.Diagnostics.Process API

System.Diagnostics.Processp = new Systems.Diagnostics.Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = "cmd";
p.StartInfo.Arguments = "..."; // Your command and args here
p.StartInfo.RedirectStandartOutput = true;

p.Start();
p.WaitForExit();

string output = p.StandardOutput.ReadToEnd();

or similar.

Regards
 
You can use Process.Start

Process process = new Process();
process.StartInfo.FileName = "CVS.exe";
process.StartInfo.Arguments = "if any";
process.Start();


-Hitesh Ramchandani.
 
Hi Guys,

Thanks for your response.

As you said I execute this code in page load event. But nothing was
happenned,

System.Diagnostics.Process runner = new System.Diagnostics.Process();
runner.StartInfo.UseShellExecute=false;
runner.StartInfo.FileName = "cmd.exe";
runner.StartInfo.Arguments = "copy c:\\bsm\\a.txt c:\\bsm\\b.txt";
runner.StartInfo.RedirectStandardOutput=true;
runner.Start();

What could be the problem!
 
In the following line I typed wrong:
runner.StartInfo.Arguments = "copy c:\\bsm\\a.txt c:\\bsm\\b.txt";

plz take this line: runner.StartInfo.Arguments = "copy c:\bsm\a.txt
c:\bsm\b.txt";
 
Back
Top