How to get Windows Directory?

  • Thread starter Thread starter Shelby
  • Start date Start date
S

Shelby

Hi,
is there a better way to get the Windows directory?
I manage to get the system directory with :
System.Environment.SystemDirectory

So I was wondering how do I get the Windows directory?
 
* "Shelby said:
So I was wondering how do I get the Windows directory?

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):

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