简体   繁体   中英

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 ie; Purely using internal features of c#.

Your suggestions are greatly appreciated.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM