以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 怎么读电脑最后一个硬盘盘符 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=47282) |
-- 作者:temblar -- 发布时间:2014/3/7 15:47:00 -- 怎么读电脑最后一个硬盘盘符
怎么读取电脑最后一个硬盘分区的盘符?一定是硬盘 不含光驱。下面是我曲线救国的代码,求正解
Dim pan As String
Dim MyPath() As String = {"c:\\","d:\\","e:\\","f:\\","g:\\","h:\\"} Dim MyFolder As String For i As Integer = 0 To 5 try MyFolder = Dir(mypath(i) & "*.*", vbDirectory) If MyFolder <> "" Then pan = mypath(i) End If
Catch ex As Exception pan = mypath(i-1) End Try Next Output.Show(pan) |
-- 作者:Bin -- 发布时间:2014/3/7 15:58:00 -- Dim ds() As System.IO.DriveInfo = System.IO.DriveInfo.GetDrives() |