Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: VB7
Expertise: Intermediate
Jun 15, 2002



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Retrieve Windows and System directories

In VB.NET you don't need to call the GetWindowsDirectory and GetSystemDirectory API functions to retrieve the path the Windows and System directories. Retrieving the System directory is as simple as calling the Environment.SystemDirectory property:

Dim sysDir As String = Environment.SystemDirectory()
The Environment class doesn't expose any property that returns the Windows directory; however, it is simple to extract the first portion of the system directory's path, by using the GetDirectoryName method of the System.IO.Path class:

Dim winDir As String = System.IO.Path.GetDirectoryName _
Alternatively, you can retrieve the Windows directory by reading the WINDIR environment variable:

winDir = Environment.GetEnvironmentVariable("WINDIR")
Francesco Balena
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date