How to get Windows Directory in C#

  • Thread starter Thread starter Guest
  • Start date Start date
* "=?Utf-8?B?TWljaGFlbA==?= said:
Can any of you tell me how to get WindowsDirectory using C#?
Thanks.

System directory:

'Environment.GetFolderPath(Environment.SpecialFolder.System))'

Windows directory:

'System.Environment.ExpandEnvironmentVariables("%WinDir%")'

- or -

Trick by Bill McCarthy:

'System.Environment.GetFolderPath(CType(&H24, System.Environment.SpecialFolder))'

- or -

P/invoke on 'GetWindowsDirectory' (IMO the preferred way):

<http://groups.google.de/groups?selm=#pJhic2CBHA.2200@tkmsftngp07>
 
Back
Top