Get a reference to windows directory ?

  • Thread starter Thread starter JezB
  • Start date Start date
J

JezB

There is no enumeration for the windows directory in SpecialDirectories, how
can I get the windows directory path ?
 
Depending on which directory you want...

Dim WinDir As String =
Environment.GetFolderPath(Environment.SpecialFolder.System)
WinDir += vbCrLf & Environment.ExpandEnvironmentVariables("%SYSTEMROOT%")
MsgBox(WinDir)
 
* "JezB said:
There is no enumeration for the windows directory in SpecialDirectories, how
can I get the windows directory path ?

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