文件帮助类

DriveInfo[] drive = DriveInfo.GetDrives();
foreach (DriveInfo info in drive)
{
string driveName = info.Name;
}

//获取当前系统磁盘符方法1,返回:C:
string path = Environment.GetEnvironmentVariable("systemdrive");
//获取当前系统磁盘符方法2,返回:C:
string path = Environment.ExpandEnvironmentVariables("%systemdrive%");
Console.WriteLine(path);
//获取当前系统目录
Console.WriteLine("GetFolderPath: {0}",Environment.GetFolderPath(Environment.SpecialFolder.System));
//获取当前系统桌面
Console.WriteLine("GetFolderPath: {0}", Environment.GetFolderPath(Environment.SpecialFolder.System));

  

上一篇:同时开启两个Tomcat


下一篇:java.day1