在vba中使用shell命令删除扩展名为.c的所有文件

我想从VBA的shell命令删除文件夹中的所有带有扩展名“.c”的文件,下面的代码我不能在VBAmacros中执行。 如果文件夹名称中包含空格或应该在代码中做什么更改,是否应该有任何问题

all_C_Files = Selected_User_Output_Folder & "*.C" Shell "cmd /c del /F" & all_C_Files 'Selected_User_Output_Folder = "C:\Users\Berater\Desktop\Config File Generator" 

为什么使用shell命令时可以使用kill

 Sub test() Selected_User_Output_Folder = "C:\Users\Berater\Desktop\Config File Generator\*.c" On Error Resume Next Kill Selected_User_Output_Folder End Sub 

总是引用文件/文件夹path的好习惯:

 all_C_Files = Selected_User_Output_Folder & "*.C" Shell "cmd /c del /F """ & all_C_Files & """"