参考链接:https://www.cnblogs.com/tianma3798/p/5500307.html

    1.获取方式如下
    Environment.SpecialFolder中定义了许多常用的目录
    //获取当前系统磁盘符方法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.Desktop));