Link to home
Start Free TrialLog in
Avatar of srinivas_gowd
srinivas_gowd

asked on

How To Find the windowssystem directory without using API Calls from Visual Basic

Hi all

Can Any body tell me "How to get the windows system directory without using visual basic "


thanks in advantage

Srinivas Gowd

srinivas_gowd@yahoo.co.uk
ASKER CERTIFIED SOLUTION
Avatar of Brian Mulder
Brian Mulder
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or in dos

echo %WINDIR%
Avatar of Ryan Chong
Public Const MAX_PATH = 260
Public Declare Function GetSystemDirectory Lib "kernel32" Alias "GetSystemDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long

Public Function GetSystemDir() As String
    Dim strBuffer As String
    Dim lngReturn As Long
    Dim strWindowsSystemDirectory As String
   
    strBuffer = Space$(MAX_PATH)
    lngReturn = GetSystemDirectory(strBuffer, MAX_PATH)
    strWindowsSystemDirectory = Left$(Trim$(strBuffer), Len(Trim$(strBuffer)) - 1)
    GetSystemDir = strWindowsSystemDirectory
End Function
to me that is an API call or not ;)
haha, if not using VB, then code is not applicable. :)
Accept bruintje's comment as answer
Moderator, my recommended disposition is:

    Accept bruintje's comment(s) as an answer.

DanRollins -- EE database cleanup volunteer