Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If it says this then do this!?

Status
Not open for further replies.

TDogg

MIS
Dec 11, 2000
11
US
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?

Thanks
-TDG
 
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 = fso_OpenTextFile("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


Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top