c# directory c d drive 찾기
drives list in c#
var drives = DriveInfo.GetDrives();
foreach (var drive in drives)
{
if (drive.DriveType == DriveType.Removable)
{
Console.WriteLine(drive.Name);
}
}
var drives = DriveInfo.GetDrives();
foreach (var drive in drives)
{
if (drive.DriveType == DriveType.Fixed)
{
if (drive.Name.ToLower().Equals("d:\\"))
{
path = "d:/TEMP";
break;
}
else
{
path = "c:/TEMP";
}
}
}
원하는 드라이브를 찾을 수 있다.
댓글 없음:
댓글 쓰기