This isn't of great help has the value stored is a placeholder
(%SystemRoot%) which gets expanded by the OS before it's returned in the
environment block of the logon user, you will have to expand this on the
remote system to get it's real value. Much easier is to use
System.Management to get at this kind of info.
Willy.
Alas you're correct but I didn't know what native .NET methods were
available to retrieve this info (which he should normally depend on of
course). However, it was really a direct answer to his question though I'm
still not 100% certain of his intentions (though I should have clarified
it). He may literally require the value of this environment variable in its
raw or expanded state. This could even differ from %SYSTEMROOT% in theory
(and the value returned by your own example) so he needs to confirm what
he's really looking for, the value of "windir" (expanded or otherwise), or
the path of the windows folder regardless of "windir". In any case, I didn't
take the time to look at what the default value for "windir" was (in terms
of other environment variables) since he could normally plug in any other
environment variables in as required. This would involve some extra work to
parse "windir" and expand any other embedded variables but it's a fairly
trivial exercise. "%SystemRoot% however presents an impediment since it's
one of several predefined environment variables that isn't stored as a
regular environment variable. Its actual value would therefore need to be
(remotely) tracked down but it's potentially doable (I'd have to look). The
logged on user on the remote machine is another matter however. He shouldn't
depend on any expansion associated with that user via the remote equivalent
of "ExpandEnvironmentStrings()" and cousin(s). "windir" is a system
environment variable so it shouldn't be defined in terms of user environment
variables. There may not even be any interactive user at the time or call or
it's even possible there could be more than one interactive logon session
(even without any human actually being logged on in theory).