readini.vbs

来自「Apress - Managing Enterprise Systems Wit」· VBS 代码 · 共 23 行

VBS
23
字号
'readini.vbs
Dim dAccess

dAccess = ReadINI("e:\data.ini", "DateLastAccessed")

Function ReadINI(strINIFile, strKey)
 Dim objFSO, objTextFile, strLine

 Set objFSO = CreateObject("Scripting.FileSystemObject")
 Set objTextFile = objFSO.OpenTextFile(strINIFile)

 'loop through each line of file and check for key value
 Do While Not objTextFile.AtEndOfStream
    strLine = objTextFile.ReadLine
    If Left(strLine, Len(strKey) + 1) = strKey & "=" Then
        ReadINI = Mid(strLine, InStr(strLine, "=") + 1)
    End If
 Loop

 objTextFile.Close

End Function

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?