我使用以下命令格式化USB驱动器:
FDrive.FileName = "format.com"
FDrive.Arguments = Mid(TDir, 6, 2) & ForQ & Mid(TDir, 9, 4)
FDrive.UseShellExecute = False : FDrive.CreateNoWindow = True
FDrive.RedirectStandardOutput = True : FDrive.RedirectStandardInput = True
FProcess = Process.GetProcessesByName("format.com")
TimerX.Enabled = True : TimerX.Start()
If FormatDriveX.IsBusy = False And Can > 0 Then : FormatDriveX.RunWorkerAsync(x) : End If
然后,Backgroundworker只需调用FDrive任务即可开始格式化:
Process.Start(FDrive)
如果我从CMD开始格式化,它将提供进度指示器。 如何访问此值以在进度栏中使用?