Click here to Skip to main content
15,897,187 members
Articles / Desktop Programming / Windows Forms

NVM - eNvironment Variables Manager

Rate me:
Please Sign up or sign in to vote.
3.91/5 (10 votes)
14 Oct 2007CPOL3 min read 53.1K   506   17  
NVM is a easy-to-use tool written in C# 3.0. The aim of this tool is to allow easy administration of Windows Environment Variables.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;

namespace NVM
{
    public class UserEnvData : BaseEnvData
    {
        public UserEnvData() : base()
        {
        }

        public override void Initialize()
        {
            base.Initialize();

            // Get the User Environment Variables
            RegistryKey theKey = Registry.CurrentUser;
            theKey = theKey.OpenSubKey(@"Environment", true);

            // GetValueNames will return the names of all the keys within the Enviroment Key
            foreach (string key in theKey.GetValueNames())
            {
                string keyValue = (theKey.GetValue(key)).ToString();

                EnvData data = new EnvData(key, keyValue);

                _envData.Add(data);
            }

            theKey.Close();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United States United States
An individual with more than a decade of experience in desktop computing and mobile app development primarily on the Microsoft platform. He loves programming in C#, WPF & XAML related technologies.
Current interests include web application development, developing rich user experiences across various platforms and exploring his creative side.

Ratish's personal blog: wpfspark.wordpress.com

Comments and Discussions