System.Environment
Object –> Environment
- Information about and manipulation of the current environment and platform.
- Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.environment?view=net-6.0
properties
CommandLineReturns the command line arguments as a string where the first term is the command itselfCurrentDirectoryGets or sets the CWDExitCodeIs64BitOperatingSystemBoolean if OS is 64-bitIs64BitProcessBoolean if the current process if 64-bitMachineNameReturns the system’s nameNewLineReturns a platform-independent newline (\r\n for non-Unix platforms; \n for Unix platforms)OSVersionReturns an OperatingSystem OSVersion object. See also: OSVersion.VersionStringProcessIdReturns the PID of the current process as an intProcessorCountReturns the number of processors available to the current processProcessPathReturns the path of the executable that started the current processStackTraceReturns current stack trace informationSystemDirectoryReturns the path of the system directoryTickCount64Returns the number of milliseconds elapsed since the system startedUserDomainNameReturns the domain username of the current userUserNameReturns the username of the current process
methods
Exit(int)Terminate this process and return exit code int to the OSFailFast(string)Terminate this process immediately (do not run Catch blocks), and write string to Application event logGetCommandLineArgs()Returns the command line arguments as a string[].[0]is the executable nameGetEnvironmentVariable(string)Return environment variable string or null if not foundGetEnvironmentVariables()Return all environment variables as a DictionaryGetFolderPath(Environment.SpecialFolder)Return the path of SpecialFolderGetLogicalDrives()Return all logical drives as an array of stringsSetEnvironmentVariable(string variable, string value)Set environment variable to value.
SpecialFolder
Object –> ValueType –> Enum –> Environment.SpecialFolder
Enumerated constants for special system folders.
fields
ApplicationData
MyDocuments
Personal
System