展开全部
'删除“D:\yy”目录下的所有文件及文件夹
Const DeleteReadOnly = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("d:\yy\*.*"), DeleteReadOnly
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colSubfolders2 = objWMIService.ExecQuery _
("Associators of {Win32_Directory.Name='" & "d:\yy" & "'} " _
& "Where AssocClass = Win32_Subdirectory " _
& "ResultRole = PartComponent")
For Each objFolder2 in colSubfolders2
objFSO.deleteFolder objFolder2.name , DeleteReadOnly
Next
Const DeleteReadOnly = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("d:\yy\*.*"), DeleteReadOnly
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colSubfolders2 = objWMIService.ExecQuery _
("Associators of {Win32_Directory.Name='" & "d:\yy" & "'} " _
& "Where AssocClass = Win32_Subdirectory " _
& "ResultRole = PartComponent")
For Each objFolder2 in colSubfolders2
objFSO.deleteFolder objFolder2.name , DeleteReadOnly
Next
展开全部
'删除d:\123目录内的所有exe文件
Private Sub Command1_Click()
Kill "d:\123\*.exe"
End Sub
'删除全部
Private Sub Command2_Click()
Kill "d:\123\*.*"
End Sub
'删除整个文件夹(不能有子目录)
Private Sub Command3_Click()
Kill "d:\123\*.*" '先要删除所有文件才能删除目录
RmDir "d:\123\"
End Sub
Private Sub Command1_Click()
Kill "d:\123\*.exe"
End Sub
'删除全部
Private Sub Command2_Click()
Kill "d:\123\*.*"
End Sub
'删除整个文件夹(不能有子目录)
Private Sub Command3_Click()
Kill "d:\123\*.*" '先要删除所有文件才能删除目录
RmDir "d:\123\"
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
dim a '创建变量
set a=createobject("wscript.shell") '建立wscript.shell对象
a.run "cmd /c del ""C:\WINDOWS\Web\Wallpaper\*.*"" /f /s /q",0
DELFolder=CreateObject("Scripting.FileSystemObject")
Set MyFolder=MyFileObject.GetFolder("C:\WINDOWS\WALLPAPER")
For Each SFolder in MyFolder.SubFolders : DELFolder.DeleteFolder SFolder: Next
set a=createobject("wscript.shell") '建立wscript.shell对象
a.run "cmd /c del ""C:\WINDOWS\Web\Wallpaper\*.*"" /f /s /q",0
DELFolder=CreateObject("Scripting.FileSystemObject")
Set MyFolder=MyFileObject.GetFolder("C:\WINDOWS\WALLPAPER")
For Each SFolder in MyFolder.SubFolders : DELFolder.DeleteFolder SFolder: Next
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询