5
Answers

How to pass an argument to cmd.exe ?

  1. static void Main(string[] args)  
  2.         {  
  3.               
  4.               Process p = new Process();  
  5.               ProcessStartInfo startInfo = new ProcessStartInfo();  
  6.               startInfo.FileName =@"C:\systemprocess\cmd.exe";  
  7.               //I want to pass an argument to my cmd.exe  
  8.                
  9.               p.StartInfo = startInfo;  
  10.               p.Start();  
  11.           }  
This will open the cmd.exe . But I want to Send something programmatic.
Actually When I open Cmd I will give
  1. 1) d:  
  2. 2) cd folder1  
  3. 3) Force it 10.10.26.0 -a  
 I will type this in exe.Now I want to this in Programmatic.How to do this?
Answers (5)