Set environment variable in CSharp

Description

The following code shows how to set environment variable.

Example


/* w  ww.ja  v a 2s  .  c o m*/
using System;
using System.Collections;
using Microsoft.Win32;

class Sample 
{
    public static void Main(){
       Environment.SetEnvironmentVariable("A_GETSET_ENVAR_SAMPLE", null, EnvironmentVariableTarget.Process);
    }
   
}




















Home »
  C# Tutorial »
    Development »




Console
Encoding
Environment
Random