C#: 得到系统中的环境变量(源代码)

using System;
using System.Collections;

namespace Project1
{
    class ListSystemProperties
    {
        static void Main()
        {
            System.Console.WriteLine("\tKey\t\t\tValue");
            foreach (DictionaryEntry enValue in Environment.GetEnvironmentVariables())
            {
                string key = enValue.Key.ToString();
                string value = enValue.Value.ToString();
                System.Console.WriteLine("\t"+key);
                System.Console.WriteLine("\t\t" + value);
            }
        }
    }
}
posted @ 2007-01-17 16:16  玉泉老博  阅读(1630)  评论(0编辑  收藏  举报
Free counter and web stats