I have the following code to read a text file:
Option Explicit
Dim InputFile
Dim FSO, oFile
Dim strData
InputFile = "C:\Program Files (x86)\AVG\CloudCare\ClientVersion.txt"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set oFile = FSO.OpenTextFile(InputFile)
strData = oFile.ReadAll
oFile.Close
msgbox strData
The contents of ClientVersion.txt is:
CLIENT_VERSION_STRING _T("3.5.2") //
When I run the VBS code, I get back this:
If I create a new text file with the same content in the same location, it works fine. Is there a reason why VBS is unable to read this simple text file? I couldn't see any issues with permissions on the file.