Get and set Environment variables in C#
from https://stackoverflow.com/questions/185208/how-do-i-get-and-set-environment-variables-in-c
var value = System.Environment.GetEnvironmentVariable(variable [, Target])
and
System.Environment.SetEnvironmentVariable(variable, value [, Target])
a.bat
set TOOLID=TEST
set INIPATH=D:\work\
CALL AAUtility.exe
C#
//Environment.SetEnvironmentVariable("TOOLID", @"TEST");
//Environment.SetEnvironmentVariable("INIPATH", @"D:\work\");
TOOLID = System.Environment.GetEnvironmentVariable("TOOLID");
iniPath = System.Environment.GetEnvironmentVariable("INIPATH");
留言
張貼留言