KILL 删除文件
RmDir path 删除目录或文件夹
如果没有指定驱
动器,则RmDir会在当前驱动器上删除目录或文件夹。如果想要使用RmDir删除一个含有文件的目录或文件夹,则会发生错误。只有用Kill语句删除所有文件后,才能用来RmDir删除目录或文件夹
问题补充:照你的意思 看来一句话完成你想要的命令是不行的。必须先列举里面的的文件夹 然后删除里面的文件在删除文件才可以,不过这样比较麻烦,我刚从别处摘抄了一段代码 是强行删除带有文件的目录,你自己在套用里面的函数就可以了,希望对你有帮助。。
'VB强行删除目录或(VB强行删除文件)模块源码
Public Enum FO_Operation
FO_MOVE = 1
FO_COPY = 2
FO_DELETE = 3
FO_RENAME = 4
End Enum
Public Enum FOFlags
FOF_MULTIDESTFILES = &H1 'Destination specifies multiple files
FOF_SILENT = &H4 'Don't display progress dialog
FOF_RENAMEONCOLLISION = &H8 'Rename if destination already exists
FOF_NOCONFIRMATION = &H10 'Don't prompt user
FOF_WANTMAPPINGHANDLE = &H20 'Fill in hNameMappings member
FOF_ALLOWUNDO = &H40 'Store undo information if possible
FOF_FILESONLY = &H80 'On *.*, don't copy directories
FOF_SIMPLEPROGRESS = &H100 'Don't show name of each file
FOF_NOCONFIRMMKDIR = &H200 'Don't confirm making any needed dirs
End Enum
Public Type SHFILEOPSTRUCT
hwnd As Long
wFunc As Long
pFrom As String
pTo As String
fFlags As Integer
fAnyOperationsAborted As Long
hNameMappings As Long
lpszProgressTitle As Long ' only used if FOF_SIMPLEPROGRESS
End Type
Private Declare Function SHFileOperation Lib "shell32.dll" Alias "SHFileOperationA" (lpFileOp As SHFILEOPSTRUCT) As Long
Private op As SHFILEOPSTRUCT