I want this program to read the system.ini.. n if it says "shell=*explorer.exe" in it to do something.. how do i get it know notice the shell=*.explore?
Set a reference to Microsoft Scripting Runtime and then use the FileSystemObject to open the file. Read all of the file into a variable and then search the variable for your string:
Const ForReading = 1
Dim fso As FileSystemObject
Dim f As File
Dim sContents As String
Set fso = CreateObject("Scripting.FileSystemObject"
Set f = fspenTextFile("path_and_name_of_file", ForReading)
sContents = f.ReadAll
Set f = Nothing ' destroy object
Set fso = Nothing ' destroy object
If InStr(sContents, "shell=*explorer.exe" > 0 Then
' found the string
Else
' did not find the string
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.