Wiki Home

System Folder


Namespace: WIN_COM_API

Full path to the Windows System folder.

Examples

Path
OS
c:\winnt\system32
Windows NT 4 / Win2000
c:\windows\system
Windows 98

getenv("systemroot") + "\system32"
or
getenv("windir") + "\system"
are more portable
You can also use in case someone has an 'odd installation'
FUNCTION  getSysDir 
   DECLARE INTEGER GetSystemDirectory IN kernel32 STRING @lpBuffer, INTEGER nSize  
   lpBuffer = SPACE (100)  
   nRetSize = GetSystemDirectory (@lpBuffer, Len(lpBuffer))  
   RETURN SUBSTR (lpBuffer, 1, nRetSize)  
ENDFUNC

FUNCTION getWinDir()
   DECLARE INTEGER GetWindowsDirectory IN kernel32 STRING @ lpBuffer,INTEGER nSize
   lpBuffer = space(100)
   nRetSize = GetWindowsDirectory(@lpBuffer,100)
   RETURN SubStr(lpBuffer,1,nRetSize)
ENDFUNC

-- Peter Easson
You can get a similar result using ?WSH:
#define WINDOWSFOLDER 0
#define WINDOWSSYSTEMFOLDER 1
#define TEMPFOLDER 2
oWsh = CreateObject("Scripting.FileSystemObject")
? oWsh.GetSpecialFolder(WINDOWSFOLDER).Name

-- Alex Feldstein
Category Code Samples
( Topic last updated: 2001.10.20 06:52:49 PM )