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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top