【C#】環境系

環境変数の値を取得


var ret = System.Environment.GetEnvironmentVariable("環境変数名");
// 変数名があれば値、なければNULL

実行中のプログラムのexe/dllのパスを取得


var ret = System.Reflection.Assembly.GetExecutingAssembly(); // 実行中のアセンブリ
var path = System.IO.Path.GetDirectoryname(new System.Uri(ret.Location).LocalPath); // exe,dllのディレクトリ