Access diskpart.exe in C# class

259 Views Asked by At

I got error win32exception was unhandled using this in class on this part

Process dip = new Process();
dip.StartInfo.FileName = @"C:\Windows\System32\diskpart.exe";
dip.StartInfo.RedirectStandardInput = true;
dip.StartInfo.RedirectStandardOutput = true;
dip.StartInfo.CreateNoWindow = true;
dip.StartInfo.UseShellExecute = false;
dip.Start();
dip.StandardInput.WriteLine("list disk");
dip.StandardInput.Flush();
dip.StandardInput.Close();
dip.WaitForExit();

on dip.Start(); program paused and i saw that error. how can i fix this? please help!

0

There are 0 best solutions below