我搜索並嘗試了用VBS刪除桌面上的特定文件的各種方法。如何使用VBS爲所有用戶刪除桌面文件?
我的代碼從來沒有錯誤
它只是不刪除文件。無論它是一個Delete.txt測試文件還是我真正想要移除的.url和.website文件。以下是一些幫助後的修改後的代碼。
Set Shell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
DesktopPath = Shell.SpecialFolders("Desktop")
A = DesktopPath & "\Kronos Workforce Central(R).url"
FSO.DeleteFile A
B = DesktopPath & "\Kronos Workforce Central(R).website"
FSO.DeleteFile B
Line: 6
Char: 1
Error: File not found
Code: 800A0035
Source: Microsoft VBScript run time error
我的電腦不知道FSO是什麼?是否有另一種方法從桌面上刪除已知的文件?