当前位置:首页 > 网络编程 > WEB编程 > ASP > FileSystemObject(FSO)简单代码

FileSystemObject(FSO)简单代码

点击次数:85 次 发布日期:2008-10-28 09:42:03 作者:源代码网
源代码网推荐

源代码网整理以下在本节描述的示例代码,提供真实的例子来示范在 FileSystemObject 对象模式中可用的许多功能。该代码显示了如何一起使用对象模式的所有功能,以及如何在您自己的代码中有效地使用这些功能。

源代码网整理以下请注意,由于该代码是极一般的,所以要使该代码能够真正在您的机器上运行,可能需要一些其他代码和小小的变更。这些改变之所以必要,是因为在 Active Server Pages 和 Windows Scripting Host 之间,为输入和输出给用户采用了不同的方法。

源代码网整理以下要在 Active Server Pages 上运行该代码,则采取以下步骤:

源代码网整理以下创建一个标准的 Web 页,后缀名为 .asp。
把下面的示例代码复制到 <BODY>...</BODY> 标记之间的文件中。
把所有代码封装到 <%...%> 标记内。
把 Option Explicit 语句从当前位置移动到 HTML 页的最顶部,甚至在 <HTML> 开始标记前。
把 <%...%> 标记放置在 Option Explicit 语句周围,以保证它在服务器端运行。
把下面的代码添加到示例代码末尾:
Sub Print(x) Response.Write "<PRE><FONT face="宋体"" SIZE=""1"">" Response.Write x Response.Write "</FONT></PRE>" End Sub Main
前面的代码增加一个将在服务器端运行,但在客户端显示结果的打印过程。要在 Windows Scripting Host 上运行该代码,则把下面的代码添加到示例代码的末尾:
Sub Print(x) WScript.Echo x End Sub Main
下面就是示例代码:

源代码网整理以下

以下为引用的内容:

源代码网整理以下--------------------------------------------------------------------------------

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" FileSystemObject 示例代码
"
"Copyright 1998  Microsoft Corporation。保留所有权利。
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

源代码网整理以下Option Explicit

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"


" 对于代码质量:
"
" 1) 下面的代码有许多字符串操作,用&quot;&amp;&quot;运算符来把短字符串连接在一起。由于
"    字符串连接是费时的,所以这是一种低效率的写代码方法。无论如何,它是
"    一种非常好维护的写代码方法,并且在这儿使用了这种方法,因为该程序执行
"    大量的磁盘操作,而磁盘操作比连接字符串所需的内存操作要慢得多。
"    记住这是示范代码,而不是产品代码。
"
" 2) 使用了 &quot;Option Explicit&quot;,因为访问声明过的变量,比访问未声明的变量要
"    稍微快一些。它还能阻止在代码中发生错误,例如,把 DriveTypeCDROM 误拼
"    成了 DriveTypeCDORM 。
"
" 3) 为了使代码更可读,该代码中没有错误处理。虽然采取了防范措施,来保证代码
"    在普通情况下没有错误,但文件系统是不可预知的。在产品代码中,使用
"    On Error Resume Next 和 Err 对象来捕获可能发生的错误。

源代码网整理以下

源代码网整理以下以下为引用的内容:

源代码网整理以下"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" 一些容易取得的全局变量
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

源代码网整理以下Dim TabStop
Dim NewLine

源代码网整理以下Const TestDrive = &quot;C&quot;
Const TestFilePath = &quot;C:Test&quot;

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" 由 Drive.DriveType 返回的常数
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

源代码网整理以下Const DriveTypeRemovable = 1
Const DriveTypeFixed = 2
Const DriveTypeNetwork = 3
Const DriveTypeCDROM = 4
Const DriveTypeRAMDisk = 5

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" 由 File.Attributes 返回的常数
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

源代码网整理以下Const FileAttrNormal  = 0
Const FileAttrReadOnly = 1
Const FileAttrHidden = 2
Const FileAttrSystem = 4
Const FileAttrVolume = 8
Const FileAttrDirectory = 16
Const FileAttrArchive = 32
Const FileAttrAlias = 64
Const FileAttrCompressed = 128

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" 用来打开文件的常数
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

源代码网整理以下Const OpenFileForReading = 1
Const OpenFileForWriting = 2
Const OpenFileForAppending = 8

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" ShowDriveType
"
" 目的:
"
" 生成一个字符串,来描述给定 Drive 对象的驱动器类型。
"
" 示范下面的内容
"
" - Drive.DriveType
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

源代码网整理以下Function ShowDriveType(Drive)

源代码网整理以下 Dim S
 
 Select Case Drive.DriveType
 Case DriveTypeRemovable
  S = &quot;Removable&quot;
 Case DriveTypeFixed
  S = &quot;Fixed&quot;
 Case DriveTypeNetwork
  S = &quot;Network&quot;
 Case DriveTypeCDROM
  S = &quot;CD-ROM&quot;
 Case DriveTypeRAMDisk
  S = &quot;RAM Disk&quot;
 Case Else
  S = &quot;Unknown&quot;
 End Select

源代码网整理以下 ShowDriveType = S

源代码网整理以下End Function

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" ShowFileAttr
"
" 目的:
"
" 生成一个字符串,来描述文件或文件夹的属性。
"
" 示范下面的内容
"
" - File.Attributes
" - Folder.Attributes
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

源代码网整理以下Function ShowFileAttr(File) " File 可以是文件或文件夹

源代码网整理以下 Dim S
   Dim Attr
 
 Attr = File.Attributes

源代码网整理以下 If Attr = 0 Then
  ShowFileAttr = &quot;Normal&quot;
  Exit Function
 End If

源代码网整理以下 If Attr And FileAttrDirectory  Then S = S &amp; &quot;Directory &quot;
 If Attr And FileAttrReadOnly   Then S = S &amp; &quot;Read-Only &quot;
 If Attr And FileAttrHidden     Then S = S &amp; &quot;Hidden &quot;
 If Attr And FileAttrSystem     Then S = S &amp; &quot;System &quot;
 If Attr And FileAttrVolume     Then S = S &amp; &quot;Volume &quot;
 If Attr And FileAttrArchive    Then S = S &amp; &quot;Archive &quot;
 If Attr And FileAttrAlias      Then S = S &amp; &quot;Alias &quot;
 If Attr And FileAttrCompressed Then S = S &amp; &quot;Compressed &quot;

源代码网整理以下 ShowFileAttr = S

源代码网整理以下End Function

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" GenerateDriveInformation
"
" 目的:
"
" 生成一个字符串,来描述可用驱动器的当前状态。
"
" 示范下面的内容
"
" - FileSystemObject.Drives
" - Iterating the Drives collection
" - Drives.Count
" - Drive.AvailableSpace
" - Drive.DriveLetter
" - Drive.DriveType
" - Drive.FileSystem
" - Drive.FreeSpace
" - Drive.IsReady
" - Drive.Path
" - Drive.SerialNumber
" - Drive.ShareName
" - Drive.TotalSize
" - Drive.VolumeName
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

源代码网整理以下Function GenerateDriveInformation(FSO)

源代码网整理以下 Dim Drives
 Dim Drive
 Dim S

源代码网整理以下 Set Drives = FSO.Drives

源代码网整理以下 S = &quot;Number of drives:&quot; &amp; TabStop &amp; Drives.Count &amp; NewLine &amp; NewLine

源代码网整理以下 " 构造报告的第一行。
 S = S &amp; String(2, TabStop) &amp; &quot;Drive&quot;
 S = S &amp; String(3, TabStop) &amp; &quot;File&quot;
 S = S &amp; TabStop &amp; &quot;Total&quot;
 S = S &amp; TabStop &amp; &quot;Free&quot;
 S = S &amp; TabStop &amp; &quot;Available&quot;
 S = S &amp; TabStop &amp; &quot;Serial&quot; &amp; NewLine

源代码网整理以下 " 构造报告的第二行。
 S = S &amp; &quot;Letter&quot;
 S = S &amp; TabStop &amp; &quot;Path&quot;
 S = S &amp; TabStop &amp; &quot;Type&quot;
 S = S &amp; TabStop &amp; &quot;Ready?&quot;
 S = S &amp; TabStop &amp; &quot;Name&quot;
 S = S &amp; TabStop &amp; &quot;System&quot;
 S = S &amp; TabStop &amp; &quot;Space&quot;
 S = S &amp; TabStop &amp; &quot;Space&quot;
 S = S &amp; TabStop &amp; &quot;Space&quot;
 S = S &amp; TabStop &amp; &quot;Number&quot; &amp; NewLine

源代码网整理以下 " 分隔行。
 S = S &amp; String(105, &quot;-&quot;) &amp; NewLine

源代码网整理以下 For Each Drive In Drives

源代码网整理以下  S = S &amp; Drive.DriveLetter
  S = S &amp; TabStop &amp; Drive.Path
  S = S &amp; TabStop &amp; ShowDriveType(Drive)
  S = S &amp; TabStop &amp; Drive.IsReady

源代码网整理以下  If Drive.IsReady Then
      If DriveTypeNetwork = Drive.DriveType Then
    S = S &amp; TabStop &amp; Drive.ShareName
   Else
    S = S &amp; TabStop &amp; Drive.VolumeName
   End If   

源代码网整理以下   S = S &amp; TabStop &amp; Drive.FileSystem
   S = S &amp; TabStop &amp; Drive.TotalSize
   S = S &amp; TabStop &amp; Drive.FreeSpace
   S = S &amp; TabStop &amp; Drive.AvailableSpace
   S = S &amp; TabStop &amp; Hex(Drive.SerialNumber)

源代码网整理以下  End If

源代码网整理以下  S = S &amp; NewLine

源代码网整理以下 Next 
 
 GenerateDriveInformation = S

源代码网整理以下End Function

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" GenerateFileInformation
"
" 目的:
"
" 生成一个字符串,来描述文件的当前状态。
"
" 示范下面的内容
"
" - File.Path
" - File.Name
" - File.Type
" - File.DateCreated
" - File.DateLastAccessed
" - File.DateLastModified
" - File.Size
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

源代码网整理以下Function GenerateFileInformation(File)

源代码网整理以下 Dim S

源代码网整理以下 S = NewLine &amp; &quot;Path:&quot; &amp; TabStop &amp; File.Path
 S = S &amp; NewLine &amp; &quot;Name:&quot; &amp; TabStop &amp; File.Name
 S = S &amp; NewLine &amp; &quot;Type:&quot; &amp; TabStop &amp; File.Type
 S = S &amp; NewLine &amp; &quot;Attribs:&quot; &amp; TabStop &amp; ShowFileAttr(File)
 S = S &amp; NewLine &amp; &quot;Created:&quot; &amp; TabStop &amp; File.DateCreated
 S = S &amp; NewLine &amp; &quot;Accessed:&quot; &amp; TabStop &amp; File.DateLastAccessed
 S = S &amp; NewLine &amp; &quot;Modified:&quot; &amp; TabStop &amp; File.DateLastModified
 S = S &amp; NewLine &amp; &quot;Size&quot; &amp; TabStop &amp; File.Size &amp; NewLine

源代码网整理以下 GenerateFileInformation = S

源代码网整理以下End Function

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" GenerateFolderInformation
"
" 目的:
"
" 生成一个字符串,来描述文件夹的当前状态。
"
" 示范下面的内容
"
" - Folder.Path
" - Folder.Name
" - Folder.DateCreated
" - Folder.DateLastAccessed
" - Folder.DateLastModified
" - Folder.Size
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Function GenerateFolderInformation(Folder)

源代码网整理以下 Dim S

源代码网整理以下 S = &quot;Path:&quot; &amp; TabStop &amp; Folder.Path
 S = S &amp; NewLine &amp; &quot;Name:&quot; &amp; TabStop &amp; Folder.Name
 S = S &amp; NewLine &amp; &quot;Attribs:&quot; &amp; TabStop &amp; ShowFileAttr(Folder)
 S = S &amp; NewLine &amp; &quot;Created:&quot; &amp; TabStop &amp; Folder.DateCreated
 S = S &amp; NewLine &amp; &quot;Accessed:&quot; &amp; TabStop &amp; Folder.DateLastAccessed
 S = S &amp; NewLine &amp; &quot;Modified:&quot; &amp; TabStop &amp; Folder.DateLastModified
 S = S &amp; NewLine &amp; &quot;Size:&quot; &amp; TabStop &amp; Folder.Size &amp; NewLine

源代码网整理以下 GenerateFolderInformation = S

源代码网整理以下End Function

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" GenerateAllFolderInformation
"
" 目的:
"
" 生成一个字符串,来描述一个文件夹和所有文件及子文件夹的当前状态。
"
" 示范下面的内容
"
" - Folder.Path
" - Folder.SubFolders
" - Folders.Count
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Function GenerateAllFolderInformation(Folder)

源代码网整理以下 Dim S
 Dim SubFolders
 Dim SubFolder
 Dim Files
 Dim File

源代码网整理以下 S = &quot;Folder:&quot; &amp; TabStop &amp; Folder.Path &amp; NewLine &amp; NewLine

源代码网整理以下 Set Files = Folder.Files

源代码网整理以下 If 1 = Files.Count Then
  S = S &amp; &quot;There is 1 file&quot; &amp; NewLine
 Else
  S = S &amp; &quot;There are &quot; &amp; Files.Count &amp; &quot; files&quot; &amp; NewLine
 End If

源代码网整理以下 If Files.Count &lt;&gt; 0 Then

源代码网整理以下  For Each File In Files
   S = S &amp; GenerateFileInformation(File)
  Next

源代码网整理以下 End If

源代码网整理以下 Set SubFolders = Folder.SubFolders

源代码网整理以下 If 1 = SubFolders.Count Then
  S = S &amp; NewLine &amp; &quot;There is 1 sub folder&quot; &amp; NewLine &amp; NewLine
 Else
  S = S &amp; NewLine &amp; &quot;There are &quot; &amp; SubFolders.Count &amp; &quot; sub folders&quot; &amp; NewLine &amp; NewLine
 End If

源代码网整理以下 If SubFolders.Count &lt;&gt; 0 Then

源代码网整理以下  For Each SubFolder In SubFolders
   S = S &amp; GenerateFolderInformation(SubFolder)
  Next

源代码网整理以下  S = S &amp; NewLine

源代码网整理以下  For Each SubFolder In SubFolders
   S = S &amp; GenerateAllFolderInformation(SubFolder)
  Next

源代码网整理以下 End If

源代码网整理以下 GenerateAllFolderInformation = S

源代码网整理以下End Function

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" GenerateTestInformation
"
" 目的:
"
" 生成一个字符串,来描述 C:Test 文件夹和所有文件及子文件夹的当前状态。
"
" 示范下面的内容
"
" - FileSystemObject.DriveExists
" - FileSystemObject.FolderExists
" - FileSystemObject.GetFolder
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Function GenerateTestInformation(FSO)

源代码网整理以下 Dim TestFolder
 Dim S

源代码网整理以下 If Not FSO.DriveExists(TestDrive) Then Exit Function
 If Not FSO.FolderExists(TestFilePath) Then Exit Function

源代码网整理以下 Set TestFolder = FSO.GetFolder(TestFilePath)

源代码网整理以下 GenerateTestInformation = GenerateAllFolderInformation(TestFolder)

源代码网整理以下End Function

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" DeleteTestDirectory
"
" 目的:
"
" 清理 test 目录。
"
" 示范下面的内容
"
" - FileSystemObject.GetFolder
" - FileSystemObject.DeleteFile
" - FileSystemObject.DeleteFolder
" - Folder.Delete
" - File.Delete
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Sub DeleteTestDirectory(FSO)

源代码网整理以下 Dim TestFolder
 Dim SubFolder
 Dim File
 <a name="DeleteFile">
 " 有两种方法可用来删除文件:

源代码网整理以下 FSO.DeleteFile(TestFilePath &amp; &quot;BeatlesOctopusGarden.txt&quot;)

源代码网整理以下 Set File = FSO.GetFile(TestFilePath &amp; &quot;BeatlesBathroomWindow.txt&quot;)
 File.Delete

源代码网整理以下
 " 有两种方法可用来删除文件夹:

源代码网整理以下 FSO.DeleteFolder(TestFilePath &amp; &quot;Beatles&quot;)

源代码网整理以下 FSO.DeleteFile(TestFilePath &amp; &quot;ReadMe.txt&quot;)

源代码网整理以下 Set TestFolder = FSO.GetFolder(TestFilePath)
 TestFolder.Delete

源代码网整理以下End Sub

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" CreateLyrics
"
" 目的:
"
" 在文件夹中创建两个文本文件。
"
"
" 示范下面的内容
"
" - FileSystemObject.CreateTextFile
" - TextStream.WriteLine
" - TextStream.Write
" - TextStream.WriteBlankLines
" - TextStream.Close
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Sub CreateLyrics(Folder)

源代码网整理以下 Dim TextStream
 </a><a name="CreateTextFile">
 Set TextStream = Folder.CreateTextFile(&quot;OctopusGarden.txt&quot;)
 </a><a name="WriteToFile">
 TextStream.Write(&quot;Octopus" Garden &quot;) " 请注意,该语句不添加换行到文件中。
 TextStream.WriteLine(&quot;(by Ringo Starr)&quot;)
 TextStream.WriteBlankLines(1)
 TextStream.WriteLine(&quot;I"d like to be under the sea in an octopus" garden in the shade,&quot;)
 TextStream.WriteLine(&quot;He"d let us in, knows where we"ve been -- in his octopus" garden in the shade.&quot;)
 TextStream.WriteBlankLines(2)
 </a><a name="Close">
 TextStream.Close

源代码网整理以下 Set TextStream = Folder.CreateTextFile(&quot;BathroomWindow.txt&quot;)
 TextStream.WriteLine(&quot;She Came In Through The Bathroom Window (by Lennon/McCartney)&quot;)
 TextStream.WriteLine(&quot;&quot;)
 TextStream.WriteLine(&quot;She came in through the bathroom window protected by a silver spoon&quot;)
 TextStream.WriteLine(&quot;But now she sucks her thumb and wanders by the banks of her own lagoon&quot;)
 TextStream.WriteBlankLines(2)
 TextStream.Close

源代码网整理以下End Sub

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" GetLyrics
"
" 目的:
"
" 显示 lyrics 文件的内容。
"
"
" 示范下面的内容
"
" - FileSystemObject.OpenTextFile
" - FileSystemObject.GetFile
" - TextStream.ReadAll
" - TextStream.Close
" - File.OpenAsTextStream
" - TextStream.AtEndOfStream
" - TextStream.ReadLine
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Function GetLyrics(FSO)

源代码网整理以下 Dim TextStream
 Dim S
 Dim File

源代码网整理以下 " 有多种方法可用来打开一个文本文件,和多种方法来从文件读取数据。
 " 这儿用了两种方法来打开文件和读取文件:

源代码网整理以下 Set TextStream = FSO.OpenTextFile(TestFilePath &amp; &quot;BeatlesOctopusGarden.txt&quot;, OpenFileForReading)
 </a><a name="ReadFromFile">
 S = TextStream.ReadAll &amp; NewLine &amp; NewLine
 TextStream.Close

源代码网整理以下 Set File = FSO.GetFile(TestFilePath &amp; &quot;BeatlesBathroomWindow.txt&quot;)
 Set TextStream = File.OpenAsTextStream(OpenFileForReading)
 Do  While Not TextStream.AtEndOfStream
  S = S &amp; TextStream.ReadLine &amp; NewLine
 Loop
 TextStream.Close

源代码网整理以下 GetLyrics = S
 
End Function

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" BuildTestDirectory
"
" 目的:
"
" 创建一个目录分层结构来示范 FileSystemObject。
"
" 以这样的次序来创建分层结构:
"
" C:Test
" C:TestReadMe.txt
" C:TestBeatles
" C:TestBeatlesOctopusGarden.txt
" C:TestBeatlesBathroomWindow.txt
"
"
" 示范下面的内容
"
" - FileSystemObject.DriveExists
" - FileSystemObject.FolderExists
" - FileSystemObject.CreateFolder
" - FileSystemObject.CreateTextFile
" - Folders.Add
" - Folder.CreateTextFile
" - TextStream.WriteLine
" - TextStream.Close
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
</a><a name="FolderInfo">
Function BuildTestDirectory(FSO)
 
 Dim TestFolder
 Dim SubFolders
 Dim SubFolder
 Dim TextStream

源代码网整理以下 " 排除(a)驱动器不存在,或(b)要创建的目录已经存在的情况。

源代码网整理以下 If Not FSO.DriveExists(TestDrive) Then
  BuildTestDirectory = False
  Exit Function
 End If

源代码网整理以下 If FSO.FolderExists(TestFilePath) Then
  BuildTestDirectory = False
  Exit Function
 End If

源代码网整理以下 Set TestFolder = FSO.CreateFolder(TestFilePath)

源代码网整理以下 Set TextStream = FSO.CreateTextFile(TestFilePath &amp; &quot;ReadMe.txt&quot;)
 TextStream.WriteLine(&quot;My song lyrics collection&quot;)
 TextStream.Close

源代码网整理以下 Set SubFolders = TestFolder.SubFolders

源代码网整理以下 Set SubFolder = SubFolders.Add(&quot;Beatles&quot;)

源代码网整理以下 CreateLyrics SubFolder

源代码网整理以下 BuildTestDirectory = True

源代码网整理以下End Function

源代码网整理以下""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"
" 主程序
"
" 首先,它创建一个 test 目录,以及一些子文件夹和文件。
" 然后,它转储有关可用磁盘驱动器和 test 目录的某些信息,
" 最后,清除 test 目录及其所有内容。
"
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

源代码网整理以下Sub Main

源代码网整理以下 Dim FSO

源代码网整理以下 " 设立全局变量。
 TabStop = Chr(9)
 NewLine = Chr(10)
 </a><a name="CreateFSO">
 Set FSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)

源代码网整理以下 If Not BuildTestDirectory(FSO) Then
  Print &quot;Test directory already exists or cannot be created.  Cannot continue.&quot;
  Exit Sub
 End If
 
 Print GenerateDriveInformation(FSO) &amp; NewLine &amp; NewLine

源代码网整理以下 Print GenerateTestInformation(FSO) &amp; NewLine &amp; NewLine

源代码网整理以下 Print GetLyrics(FSO) &amp; NewLine &amp; NewLine

源代码网整理以下 DeleteTestDirectory(FSO)
 
End Sub

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华