devxlogo

Find the Name of the Windows or Windows System Directory

You can quickly find the name of the Windows or the Windows System directory. Just pass “WindowsDirectory” or “WindowsSystemDirectory” into this function:

 Declare Function wu_GetWindows_	Directory Lib "Kernel" Alias _	"GetWindowsDirectory" _	(ByVal lpBuffer As String, _	ByVal nSize As Integer) As IntegerDeclare Function wu_GetWindowsSystem_	Directory Lib "Kernel" Alias _	"GetSystemDirectory" _	(ByVal lpBuffer As String, _	ByVal nSize As Integer) As IntegerFunction WinDirs$ (strDirNameNeeded$)On Error GoTo WinDirs_ErrDim strBuffer$Dim iSize%Dim iResult%iSize = 256strBuffer$ = Space$(iSize)	Select Case strDirNameNeeded$		Case "WindowsDirectory"			iResult% = wu_GetWindows_				Directory(strBuffer$, iSize)		Case "WindowsSystemDirectory"			iResult% = wu_GetWindows_				SystemDirectory(strBuffer$, iSize)	End Select	WinDirs$ = Left$_		(strBuffer$, iResult%)WinDirs_Err:	If Err Then		' Do whatever you need to here	End IfEnd Function

Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.

See also  How Seasoned Architects Evaluate New Tech

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.