zoukankan      html  css  js  c++  java
  • 获取C#运行配置信息

     1 using System;
     2 using System.Collections.Generic;
     3 using System.Linq;
     4 using System.Text;
     5 using System.IO;
     6   
     7 namespace task
     8 {
     9     class Program
    10     {
    11         static void Main(string[] args)
    12         {
    13             Console.WriteLine("OS version:"+Environment.OSVersion.ToString()); //get OS information
    14             Console.WriteLine(".NET version: "+Environment.Version.ToString()); //get net framework version
    15             Console.WriteLine("CurrentDirectory: "+Environment.CurrentDirectory.ToString()); //get current directory
    16             String[] drives = Environment.GetLogicalDrives();                             //get all drivers into a string array
    17             Console.WriteLine("GetLogicalDrives: {0}", String.Join(", ", drives));      //print all logical drivers
    18              
    19             Console.WriteLine("Login User:" + Environment.UserName.ToString());           //get login name
    20             Console.WriteLine("Memory: " + Environment.WorkingSet.ToString());            //used memory
    21             Console.WriteLine("ProcesserCount: " + Environment.ProcessorCount.ToString()); //get processor number
    22             Console.WriteLine("Domainname: " + Environment.UserDomainName.ToString());            //get domaim name
    23             System.Collections.IDictionary dict = Environment.GetEnvironmentVariables();    //get environtment variables
    24             string str = dict["Path"].ToString();
    25              
    26             Console.WriteLine("PATH"+str);
    27             Environment.SetEnvironmentVariable("Path", "Test");           //set path
    28             Console.ReadLine();
    29         }
    30     }
    31 }
  • 相关阅读:
    DAY 223 GIT
    swooleHTTP
    swooleWebSocket
    swooleUDP
    swoole异步MySql
    swooleTCP
    谈谈继承的局限性
    也谈过程决定质量
    谁该为参数负责
    使用function改进设计
  • 原文地址:https://www.cnblogs.com/smartisn/p/15789579.html
Copyright © 2011-2022 走看看