Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleFind the Windows directory without using the API
DescriptionThis example shows how to find the Windows directory without using the API in Visual Basic 6. It reads the file C:\MSDOS.SYS and looks for the windir= assignment.
KeywordsWindows directory, Windows, WinDir
CategoriesSoftware Engineering, Files and Directories, API
 
Thanks to Pablo Handler.

The prorgam opens the file C:\MSDOS.SYS and looks for the windir= assignment.

 
Private Sub Form_Load()
Dim FF As Integer
Dim LINE As String

    FF = FreeFile
    Open "C:\MSDOS.SYS" For Input As FF
    Do
        Line Input #FF, LINE
    Loop While InStr(1, LCase$(LINE), "windir=", 1) = 0
    Close FF

    Label2.Caption = Mid(LINE, 8)
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated