[VBS ] Run time..一直出現型態不符合
請教各位前輩
我想找出C:\book 裡頭的Folder 符合條件就刪掉
(條件是如果folder 名稱不是"user guide" 或 不包含 "quick" 就刪掉Folder)
但是一直出現錯誤訊息
GetFolderList.vbs(9, 2) Microsoft VBScript 執行階段錯誤: 型態不符合:
'[string: "c:\book\test\test"]'
請問我是什麼地方出錯了呢?. ? 謝謝
Option Explicit
Dim objFSO, objFolder, objSubFolders, objSubFolder, DeleteDirectory
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\book")
Set objSubFolders = objFolder.SubFolders
For each objSubFolder In objSubFolders
wscript.echo objSubFolder
if (StrComp(LCase(objSubFolder),"c:\book\user guide")<>0 or
Instr(LCase(objSubFolder),"quick",1)=0 ) then
if objFSO.Folder.Exists(objSubFolder) then
objFSO.DeleteFolder objSubFolder, True
End if
End if
Next
Set objFSO = Nothing
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.63.100.2
※ 編輯: Qiu0 來自: 210.63.100.2 (03/28 18:45)
※ 編輯: Qiu0 來自: 210.63.100.2 (03/28 18:54)
→
03/28 19:12, , 1F
03/28 19:12, 1F
→
03/28 21:45, , 2F
03/28 21:45, 2F
推
03/28 22:22, , 3F
03/28 22:22, 3F
推
03/28 22:23, , 4F
03/28 22:23, 4F
→
03/28 22:32, , 5F
03/28 22:32, 5F
→
03/28 22:37, , 6F
03/28 22:37, 6F
→
03/28 22:40, , 7F
03/28 22:40, 7F
→
03/28 22:40, , 8F
03/28 22:40, 8F
→
03/28 22:47, , 9F
03/28 22:47, 9F
→
03/29 02:15, , 10F
03/29 02:15, 10F