GetFile 方法
返回與指定路徑中某文件相應(yīng)的 File 對(duì)象。
object.GetFile(filespec)
參數(shù)
object
必選項(xiàng)。應(yīng)為 FileSystemObject 的名稱(chēng)。
filespec
必選項(xiàng)。filespec 是指定文件的路徑(絕對(duì)路徑或相對(duì)路徑)。
說(shuō)明
如果指定文件不存在,則會(huì)出現(xiàn)錯(cuò)誤。
下面例子舉例說(shuō)明如何使用 GetFile 方法:
Function ShowFileAccessInfo(filespec) Dim fso, f, s Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFile(filespec) s = f.Path "br>" s = s "Created: " f.DateCreated "br>" s = s "Last Accessed: " f.DateLastAccessed "br>" s = s "Last Modified: " f.DateLastModified ShowFileAccessInfo = sEnd Function