Click here to Skip to main content
13,551,695 members
Click here to Skip to main content
Add your own
alternative version


17 bookmarked
Posted 7 Oct 2007
Licenced CPOL

NVM - eNvironment Variables Manager

, 14 Oct 2007
Rate this:
Please Sign up or sign in to vote.
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.

Screenshot - NVM_Main.jpg


Hi, this is my first article in CodeProject. Not long ago, I was introduced to the world of .NET and the C# programming language, and I liked it very much. Moreover, being a regular visitor of CodeProject, this site helped me strengthen my skills in C#. This tool, NVM, provides me a chance to give something back to the developer community.

Editing and manipulating environment variables is a very cumbersome and non-user-friendly procedure under Windows. NVM aims at making Environment variable administration a simple and user-friendly procedure. It also provides more features than the basic environment variables editor provided by Windows.


I would like to thank Jonathan [Darka] for his SetEnv article and Vladislav Setchin for his EnvMan article which provide great insight on manipulating environment variables through code. I have extended their ideas (but not their code!). This tool is written from scratch, and it gave me an in-depth view of programming with the DataGridView. I would also like to thank Michael Bright for his great article Registry's Ins and Outs using C# which describes in detail about manipulating the Registry through C#.

Using the program

I built this application using Microsoft Visual Studio 2008 Beta 2 (Orcas), so in order to execute the application, you need to have .NET 3.0 or the .NET 3.5 runtime installed.

Using the code

In the Registry, the User environment variables are stored at:


and the System environment variables are stored at:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment

So, you can either use the System.Environment class and its GetEnvironmentVariables, GetEnvironmentVariable, SetEnvironmentVariable functions to obtain or set the values, respectively, or you can use the Microsoft.Win32.Registry and Microsoft.Win32.RegistryKey classes to directly access the Registry.

Once the value is obtained, it is split into tokens based on the separator character ";", and these tokens are displayed in the grid for easy manipulation.

Screenshot - NVM_Details.jpg

The Export feature allows the user to export the user environment variables and the system environment variables to an XML file.


I have updated the application and released the source code and binary. The following updates have been incorporated:

  • A bug related to the New button of the second form has been resolved.
  • A Browse For Folder button has been added to the second form. Using this, the user can browse for any folder of his/her choice, and once a folder is selected, its path is added to the Clipboard. This can be used to paste while editing or adding a new value.
  • The main form and the second form are now sizable. You can resize the forms to your own requirements.
  • The font size has been reduced from size 10 to size 8 to accommodate more data.

Future Features

I am planning to incorporate the following features in the future versions:

  • Add an Import feature to complement the Export feature.
  • Add progress bar support while saving to the Registry. As of now, the application hangs for sometime while saving to the Registry. I am looking into this issue. (If anyone has any ideas on how to incorporate this, their suggestions are heartily welcome :) )
  • Apart from this, if anyone has suggestions for any other features that can be added, do let me know.

    Feel free to use the source code and add your modifications. I would appreciate it if you mention my name in the modified code.


  • 14-Oct-2007: Released NVM (version 0.9.x) binary and source code.
  • 07-Oct-2007: Released the NVM binary.


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


About the Author

Ratish Philip
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:

You may also be interested in...

Comments and Discussions

GeneralNice! Pin
Julian Nicholls9-Oct-07 8:44
memberJulian Nicholls9-Oct-07 8:44 
GeneralRe: Nice! Pin
_Ratish_Philip_9-Oct-07 16:52
member_Ratish_Philip_9-Oct-07 16:52 
GeneralRe: Nice! Pin
Julian Nicholls9-Oct-07 23:23
memberJulian Nicholls9-Oct-07 23:23 
GeneralRe: Nice! Pin
_Ratish_Philip_14-Oct-07 18:06
member_Ratish_Philip_14-Oct-07 18:06 
GeneralRe: Nice! Pin
Julian Nicholls15-Oct-07 2:14
memberJulian Nicholls15-Oct-07 2:14 
GeneralIt crashes !!!!!!!!! Pin
Mohd Amanullah Zafar8-Oct-07 6:27
memberMohd Amanullah Zafar8-Oct-07 6:27 
GeneralRe: It crashes !!!!!!!!! Pin
_Ratish_Philip_8-Oct-07 6:29
member_Ratish_Philip_8-Oct-07 6:29 
GeneralRe: It crashes !!!!!!!!! Pin
_Ratish_Philip_18-Oct-07 5:42
member_Ratish_Philip_18-Oct-07 5:42 
It is fixed now!

Ratish Philip Wink | ;-)

GeneralRolback Option Pin
Mohd Amanullah Zafar8-Oct-07 6:16
memberMohd Amanullah Zafar8-Oct-07 6:16 
GeneralRe: Rolback Option Pin
_Ratish_Philip_8-Oct-07 6:19
member_Ratish_Philip_8-Oct-07 6:19 
GeneralRe: Rolback Option Pin
Mohd Amanullah Zafar8-Oct-07 6:22
memberMohd Amanullah Zafar8-Oct-07 6:22 
GeneralRe: Rolback Option Pin
_Ratish_Philip_8-Oct-07 6:24
member_Ratish_Philip_8-Oct-07 6:24 
GeneralWow..... Pin
Mohd Amanullah Zafar8-Oct-07 6:12
memberMohd Amanullah Zafar8-Oct-07 6:12 
GeneralCool. Pin
Boinst7-Oct-07 14:57
memberBoinst7-Oct-07 14:57 
GeneralRe: Cool. Pin
_Ratish_Philip_7-Oct-07 17:28
member_Ratish_Philip_7-Oct-07 17:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180515.1 | Last Updated 14 Oct 2007
Article Copyright 2007 by Ratish Philip
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid