Hey,, im writing a program using cmd commands in it....
Need Some help from experts :)

1) Question A

Process p = new Process();
            string d = txtPath.Text.ToString();
            d = d.Substring(0, 2);
           // p.StartInfo = new ProcessStartInfo("cmd", "/c \"format '+ d+ ' /fs:ntfs" );

i have some doubts to clear..

normally.. using the above code, i format a partition.. what i need to do is to check wether the formating is completed or not by using if statements..

2) Question B

how can i use diskpart's parameters with ProcessStartInfo ?
example would be

diskpart > list volume > select Volume +Variabe > Assign Letter +Variabe

how can i carry out these commands in C# using ProcessStartInfo ?

3) Qustion C

Instead of showing the cmd as a popup when i click the format button on my programe using the above code, can i load the cmd or its content inside a C# windows form ?


These are my few questions ... Please be kind to help me out ,,,
im still a 16 years old guy who loves programming :D


Thanks In Advance !

1 & 3. Redirect input/output/error stream.
2. Use Arguments property of ProcessInfo.

tnx,, can you show me a example pls ?

@ Adatapost , how can i use this Redirect input/output/error stream ? i googled it .. but couldnt find some good solutions :(

thanks alot !