Mohan Lalwani
Mohan Lalwani

Reputation: 57

How to run chkdsk on drive without command prompt in c#

I searched on internet and found many possible ways of running chkdsk utility in c# using cmd.exe as file name and passing command as /c chkdsk drive_letter:/f /x

But I want to run chkdsk utility on drive ,without involvement of cmd.exe i.e; Purely using internal features of c#.

Your suggestions are greatly appreciated.

Upvotes: 0

Views: 879

Answers (1)

C4d
C4d

Reputation: 3292

Chkdsk is a console application. So how do you wanna start a console application without the console? The only thing you can do is hiding the window from the user.

As you for sure already noticed: MSDN - Chkdsk
According the console-window:

startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.UseShellExecute = false;
startInfo.CreateNoWindow = true;

This together should bring you to your goal.

Upvotes: 1

Related Questions