【正文】
eObject() strUser = strPath = C:/Documents and Settings/ amp。 /Application Data/Microsoft/Templates Set objFSO = CreateObject() If (strPath) Then The folder exists. Else The folder does not exist. End If 9 如何列出文件夾及其所有子文件夾中的文件? strComputer = . Set objWMIService = GetObject(winmgmts:// amp。 /root/cimv2) strFolderName = c:/scripts Set colSubfolders = _ (Associators of {=39。 strFolderName amp。} _ amp。 ResultRole = PartComponent) For Each objFolder in colSubfolders GetSubFolders strFolderName Next Sub GetSubFolders(strFolderName) Set colSubfolders2 = _ (Associators of {=39。 strFolderName amp。} _ amp。 ResultRole = PartComponent) For Each objFolder2 in colSubfolders2 strFolderName = GetSubFolders strFolderName Next End Sub 10 回復 9:如何列出文件夾及其所有子文件夾中的文件? strComputer = . Set objWMIService = GetObject(winmgmts:// amp。 /root/cimv2) strFolderName = c:/scripts Set colSubfolders = _ (Associators of {=39。 strFolderName amp。} _ amp。 ResultRole = PartComponent) strFolderName arrFolderPath = Split(strFolderName, /) strNewPath = For i = 1 to Ubound(arrFolderPath) strNewPath = strNewPath amp。 arrFolderPath(i) Next strPath = strNewPath amp。 amp。 39。 amp。 39。 Where AssocClass = Win32_Subdirectory _ amp。 // amp。 // Set colFiles = _ (Select * from CIM_DataFile where Path = 39。 strPath amp。) For Each objFile in colFiles Next GetSubFolders strFolderName Next End Sub 11 如何在腳本播放一個聲音? strSoundFile = C:/Windows/Media/ Set objShell = CreateObject() strCommand = sndrec32 /play /close amp。 strSoundFile