C # environment variable print

C # code is as follows:

using System;
namespace evApplication
{
    class ev
    {
        static void Main(string[] args)
        {
            string e_variable = Environment.GetEnvironmentVariable("Path");
            string[] ev_list = e_variable.Split(';');
            
            foreach(string path in ev_list)
                Console.WriteLine(path);
            
            
            Console.ReadKey();
        }
    }
}

Suffix codes stored in a file named cs's.

 

By cmd command-line compiler .cs file suffix to generate exe files:

 

Run the exe file, you can see already listed Path environment variable:

 

Guess you like

Origin www.cnblogs.com/clb-blog/p/11202940.html