C # using the Environment to get the current running environment-related information

The former class and classes Enviroment AppDomain a system-level information, which represents the application-level information.

I used two classes to get some running directory, operating system information such as the number of bits:

String the basedir = AppDomain.CurrentDomain.BaseDirectory; // get the path running 
String resdir = String .Empty;
 IF (! String .IsNullOrWhiteSpace (the basedir))
{
    string[] paths = basedir.Split('\\');
    for (int i = 0; i < paths.Length - 2; i++)
    {
        resdir += paths[i] + "\\";
    }
}
String item0 = " on the upper running path: " + resdir; 
String ITEM1 = " run directory: " + Environment.CurrentDirectory;
 String ITEM2 = " OS newline is: " + Environment.NewLine;
 String Item3 = Environment ? .Is64BitOperatingSystem " 64-bit operating system " : " 32-bit operating system " ;
 String ITEM4 = Environment.Is64BitProcess? " 64-bit process " : " 32-bit processes " ;
string item5 = " Current system version: " + Environment.OSVersion;
 String ITEM6, = ' the CLR Version: " + Environment.Version.ToString ();
 String item8 = " current computer motherboard name: " + Environment.MachineName;
 String item9 = " Current computer processing number is: " + Environment.ProcessorCount;
 String item10 = " after the operating system has started running: " + Environment.TickCount / 1000 / 3600 + " h " ;
string item11 = "The current program (the process) of the command line: " + Environment.CommandLine;
 String item12 = " the user is using the operating system: " + Environment.UserName;
 String item13 = " logic current desktop systems: " + Environment.GetFolderPath (Environment .SpecialFolder.Desktop);
 String item14 = " current physical desktop system: " + Environment.GetFolderPath (Environment.SpecialFolder.DesktopDirectory); 
String item15 = " current program start command line parameters: " ;
 String [] args = Environment. the GetCommandLineArgs ();
 the foreach (string item in args)
{
    item15 += item + "\t";
}
String item16 = " logical drive letter has: " ;
 String [] = logicdrive Environment.GetLogicalDrives ();
 the foreach ( var Item in logicdrive)
{
    item16 += item+ "\t";
}

 

Guess you like

Origin www.cnblogs.com/bigbosscyb/p/11846452.html