Wednesday, August 22, 2007

How to find the system directory (and other environement variables)

Was looking through the msdn Forums recently and someone was asking how to get the system path to save some files... and I though hmm this sounds like a job for the my namespace.... Alas I was wrong, could not help me but then it struck me... The system.enviroment class could help. Here are some of the goodies in this class:

Returns and sets the fully qualified path of the current directory; that is, the directory from which this process starts.

Returns the NetBIOS name of this local computer.

Returns an OperatingSystem object that contains the current platform identifier and version number.

Returns the fully qualified path of the system directory.

Returns the network domain name associated with the current user.

Returns the user name of the person who started the current thread.

Returns a Version object that describes the major, minor, build, and revision numbers of the common language runtime.

Returns the amount of physical memory mapped to the process context.

me.text = System.environment.systemdirectory

No comments: