devxlogo

Find the Name of the Windows or Windows System Directory

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
See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

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.

About Our Journalist