- 删除桌面文件
- 文件名称为0.txt到5.txt
- 路径问题
- 桌面\ & 1.txt = 桌面\1.txt才是在桌面删除文件1.txt
- Administrator\桌面 & 1.txt = Administrator\桌面1.txt,在Administrator文件夹下删除的文件名是桌面1.txt
Dim file,fileName,getReturn
filePath = "C:\Documents and Settings\Administrator\桌面\" '文件路径
Set file=CreateObject("Scripting.FileSystemObject")
getReturn = MsgBox("确定要清除?", vbInformation + vbOKCancel, "警告提示")
if getReturn = vbOK then
for i = 0 to 5
fileName = i&".txt"
file.DeleteFile(filePath & fileName)
next
end if