3

ユーザーの操作なしで VB.NET を使用してドライブを FAT 16 形式でフォーマットする方法

4

1 に答える 1

0

これは、同様の質問に対するこの C# の回答の VB.NET 翻訳になります。

Dim allDrives As DriveInfo() = DriveInfo.GetDrives()
For Each d As DriveInfo In allDrives
    If d.IsReady AndAlso (d.DriveType = DriveType.Removable) Then
        Dim startInfo As New ProcessStartInfo()
        startInfo.FileName = "format.com"
        startInfo.Arguments = "/fs:FAT /v:MyVolume /q " & d.Name.Remove(2)
        startInfo.UseShellExecute = False
        startInfo.CreateNoWindow = True
        startInfo.RedirectStandardOutput = True
        startInfo.RedirectStandardInput = True

        Dim p As Process = Process.Start(startInfo)

        Dim processInputStream As StreamWriter = p.StandardInput
        processInputStream.Write(vbCr & vbLf)


        p.WaitForExit()
    End If
Next
于 2011-09-14T15:58:47.257 に答える