Reading System Env with AS3?

In Java we can simply write
to read Android SDK install location.

I know such fx like that does not exist in AS3, but how do you do that in AS3?
I already implement via NativeProcess-thing and succeed but if you don’t mind I would like to see your implementation.

var executable:NativeProcess;
var theCMD:NativeProcessStartupInfo=new NativeProcessStartupInfo();
theCMD.executable=new File("C:/Windows/System32/cmd.exe");

if(!executable.running) executable.start(theCMD);
executable.standardInput.writeUTFBytes("echo %ANDROID_SDK_ROOT%\n");


function handleCheckEnv(event:ProgressEvent):void
			var stdOutput:IDataInput=executable.standardOutput;
          return stdOutput.readUTFBytes(stdOutput.bytesAvailable);

I do about the same

little difference is I do it cross-platform detecting the platform with Capabilities.manufacturer

        private function _getPlatform():String
            var platform:String = "";
            var manufacturer:String = Capabilities.manufacturer;
            if( (manufacturer != "") && (manufacturer.indexOf( " " ) > -1) )
                var tmp:String = manufacturer.split( " " )[1];
                platform = tmp.toLowerCase();
                platform = manufacturer.toLowerCase();
            return platform;

then you can do

            switch( _getPlatform() )
                case "windows":
                filepath = "C:\\Windows\\System32\\cmd.exe";
                args[0] = "/C";
                args[1] = "echo %USERNAME%";
                case "macintosh":
                case "linux":
                filepath = "/bin/sh";
                args[0] = "-c";
                args[1] = "echo $USER";

and usually it is something called when the AIR app starts during the “boot process”

if I need many environment variables, I just grab them all





then you can parse line by line on \n and split on = etc.

alternative is to have a Redtamarin little binary that can use getevn() directly
and send the result over socket

a very basic ANE with getenv(), setenv() etc. should be easy to do
but I never had this need yet