How to get Windows Directory path

for the system folder you can use Environment.SystemDirectory , for the actual windows folder , i put this together quickly , hope it helps ....
Code:
    Declare Function GetWindowsDirectory Lib "kernel32.dll" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As System.Text.StringBuilder, ByVal nSize As Integer) As Integer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim path As New System.Text.StringBuilder(255)
        GetWindowsDirectory(path, path.Capacity)

        MessageBox.Show(path.ToString)

    End Sub
 
Back
Top