Copy from: C # using the Environment to obtain information about the current operating environment program
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 process "; 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 the number of processors: " + Environment.ProcessorCount; String item10 = " after the operating system has started running: " + Environment.TickCount / 1000 / 3600+ " H " ; String item11 = " current program (the process) of the command line: " + Environment.CommandLine; String item12 = " the user is using the operating system: " + Environment.UserName; String item13 = " logic of the current system Desktop: " + Environment.GetFolderPath (Environment.SpecialFolder.Desktop); String item14 = " physical desktop current system: " + Environment.GetFolderPath (Environment.SpecialFolder.DesktopDirectory); String item15 =" The current startup command line parameters: " ; String [] = args2 Environment.GetCommandLineArgs (); the foreach ( String Item in args2) { item15 += item + "\t"; } String item16 = " logical drive letter has: " ; String [] = logicdrive Environment.GetLogicalDrives (); the foreach ( var Item in logicdrive) { item16 += item + "\t"; } Console.ReadKey();