首页 > Windows开发 > 详细

C# 获取系统环境数据

时间:2015-01-19 20:46:38      阅读:204      评论:0      收藏:0      [点我收藏+]
using System;
using System.Data;
using System.Text.RegularExpressions;
using System.Threading;

namespace DelegateTest
{
    public class Program
    {
        public static void Main(string[] args)
        {
            Print("-----------------------------------");
            Print("Command:" + Environment.CommandLine);
            Print("CurentDir:"+Environment.CurrentDirectory);
            Print("Version:"+Environment.Version);
            Print("OS Version:"+Environment.OSVersion);
            Print("Machine:"+Environment.MachineName);
            Print("Memory:" + Environment.WorkingSet);
            Print("\n-----------------------------------");
            string[] arguments = Environment.GetCommandLineArgs();
            foreach (string str in arguments)
            {
                Print(str);
            }
            Print("\n-----------------------------------");
            string[] drivers = Environment.GetLogicalDrives();
            foreach (string str in drivers)
            {
                Print(str);
            }
            Print("\n-----------------------------------");
            Print("Path:"+Environment.GetEnvironmentVariable("Path"));
            string[] paths = Environment.GetEnvironmentVariable("Path").Split(;);
            foreach (string p in paths)
            {
                Print(p);
            }
        }

        public static void Print(string str)
        {
            Console.WriteLine(str);
        }
    }
}

 

C# 获取系统环境数据

原文:http://www.cnblogs.com/mtsl/p/4234532.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!