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
CommandLine
Returns the command line arguments as a string where the first term is the command itselfCurrent
DirectoryGets or sets the CWDExitCode
Is64BitOperatingSystem
Boolean if OS is 64-bitIs64BitProcess
Boolean if the current process if 64-bitMachineName
Returns the system’s nameNewLine
Returns a platform-independent newline (\r\n for non-Unix platforms; \n for Unix platforms)OSVersion
Returns an OperatingSystem OSVersion object. See also: OSVersion.VersionStringProcessId
Returns the PID of the current process as an intProcessorCount
Returns the number of processors available to the current processProcessPath
Returns the path of the executable that started the current processStackTrace
Returns current stack trace informationSystemDirectory
Returns the path of the system directoryTickCount64
Returns the number of milliseconds elapsed since the system startedUserDomainName
Returns the domain username of the current userUserName
Returns 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