我使用找到下一个可用字母驱动器的函数映射了网络驱动器,然后使用net use z:\ server \ z映射它,如何断开所有网络驱动器而不仅仅是z?感谢您的任何帮助 。附:我是这一切的新手:)
Dim alphabet As New System.Collections.Specialized.StringCollection()
Dim lowerBound As Integer = Convert.ToInt16("g"c)
Dim upperBound As Integer = Convert.ToInt16("z"c)
For i As Integer = lowerBound To upperBound - 1
Dim driveLetter As Char = ChrW(i)
alphabet.Add(driveLetter.ToString())
Next
lowerBound = Convert.ToInt16("a"c)
upperBound = Convert.ToInt16("i"c)
For i As Integer = lowerBound To upperBound - 1
Dim driveLetter As Char = ChrW(i)
alphabet.Add(driveLetter.ToString())
Next
' get all current drives
Dim drives As System.IO.DriveInfo() = System.IO.DriveInfo.GetDrives()
For Each drive As System.IO.DriveInfo In drives
alphabet.Remove(drive.Name.Substring(0, 1).ToLower())
Next
For Each s As String In alphabet
If System.IO.Directory.Exists(s) = False Then
Return s
End If
Next