using System;
using System.Collections;
namespace DemoConsole
{
class Program
{
static void Main(string[] args)
{
// 打印表头
Console.WriteLine("环境变量名\t=\t环境变量值");
// 把环境变量中所有的值取出来,放到变量environments中
IDictionary environments = Environment.GetEnvironmentVariables();
// 遍历environments中所有键值
foreach (string environmentKey in environments.Keys)
{
// 打印出所有环境变量的名称和值
Console.WriteLine("{0}\t=\t{1}", environmentKey, environments[environmentKey].ToString());
}
Console.Read();
}
}
}