How to 'GetWindowsDirectory' in c#

  • Thread starter Thread starter Hans
  • Start date Start date
Hi Hans!

can anybody tell me how to get the windows directory in
C#???

Just have a closer Look at the Class Environment.
The Environment Variable is SystemRoot, so you can use
Environment.GetEnvironmentVariable("SystemRoot")

With kind regards,

Konrad
 
That works alright! Thanx.

Can you tell me the difference between 'Systemroot'
and 'Windir'?

Is parameter 'Systemroot' (or 'windir') ALWAYS set?

Is it possible for the current user not to have
EnvironmentPermission with Read access?

best regards,
Hans
 
Hi Hans!

Can you tell me the difference between 'Systemroot'
and 'Windir'?

No - sorry. But in the registry, I always see %SystemRoot% and not
%windir% (Win XP Home). But %windir% is also defined!
Is parameter 'Systemroot' (or 'windir') ALWAYS set?
Yes I think so, because it is commonly used by microsoft. (On Win NT
based systems, but the .NET Framework isn't available for Win 9x/ME, so
that shouldn't matter - or am I wrong?)
Is it possible for the current user not to have
EnvironmentPermission with Read access?

Hmm ... normaly all users should have these rights. In the moment, I
cannot emagine such a constelation, but maybe it is possible with
policies to regret users that right. But of course: There variables
could be changed. But I see no reason, why somebody changes these
variables.

With kind regards,

Konrad
 
Back
Top