引用microsoft scripting runtime Option Explicit Dim fs As New FileSystemObjectPrivate Sub Command1_Click() If fs.FileExists("c:\test\a.bmp") Then fs.DeleteFile "c:\test\a.bmp" Else MsgBox "没有" End IfEnd Sub
if dir("C:\text.txt")<>"" then Kill "C:\text.txt" else msgbox "没有" endif
Option Explicit
Dim fs As New FileSystemObjectPrivate Sub Command1_Click()
If fs.FileExists("c:\test\a.bmp") Then
fs.DeleteFile "c:\test\a.bmp"
Else
MsgBox "没有"
End IfEnd Sub
Kill "C:\text.txt"
else
msgbox "没有"
endif