作者vernc (cralvin)
看板ask
標題[請問] vbs程序呼叫或引數不正確
時間Wed Apr 12 15:37:17 2023
Dim fso, folder, files
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder("R:\e") ' 取代為目標目錄的路徑
Set files = folder.Files
msgbox files.Count
If files.Count > 0 Then ' 檢查目錄下是否有檔案
files(files.Count - 1).Delete ' 刪除目錄下最後一個檔案
End If
Set files = Nothing
Set folder = Nothing
Set fso = Nothing
GPT寫的,第8行出問題
WScript.Echo files.Item(0).Name
上面這行也"程序呼叫或引數不正確"
那位教是那出錯?
thx
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 36.239.39.192 (臺灣)
※ 文章網址: https://webptt.com/m.aspx?n=bbs/ask/M.1681285039.A.3EC.html
1F:推 azdy: 問chatGPT 可能比較快 04/12 17:38
2F:→ dayend: 出在 Nothing 04/12 20:16
3F:推 if4: Nothing 沒宣告? 04/12 21:15
6F:→ yeeouo: ChatGPT是可以一直問下去的,你就跟他說這一行有問題,或 04/14 07:22
7F:→ yeeouo: 者叫他換一種寫法,他就會改給你了,你就一直問他直到ok 04/14 07:22
8F:→ yeeouo: 為止 04/14 07:22