batch-file - 批量删除不同用户文件夹中的文件

标签 batch-file cmd

如何使用批处理文件删除不同用户的文件夹中的文件?例如:

C:\Documents and Setting\UserA\Folder1\file.abc
C:\Documents and Setting\UserB\Folder1\file.abc
C:\Documents and Setting\UserC\Folder1\file.abc
C:\Documents and Setting\UserD\Folder1\file.abc
C:\Documents and Setting\UserE\Folder1\file.abc

我想删除每个用户的每个 FOLDER1 的 file.abc。每个用户都有相同的文件夹(Folder1),但他们也有更多我不想删除的文件夹。最后的文件必须是这样的。

    C:\Documents and Setting\UserA\Folder1\
    C:\Documents and Setting\UserB\Folder1\
    C:\Documents and Setting\UserC\Folder1\
    C:\Documents and Setting\UserD\Folder1\
    C:\Documents and Setting\UserE\Folder1\

我真的希望你能帮助我。

问候

最佳答案

试试这个:

for /d /r %%a in (*) do del "%%~a\Folder1\file.abc" 2>nul

关于batch-file - 批量删除不同用户文件夹中的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17001924/

相关文章:

c++ - 将批处理输出传递给 exe

powershell - 如何使用 cmd 或 powershell 检查谁有权访问文件夹

windows - 如何在不解释变量的情况下打印/回显 PATH 等 Windows 环境变量?

windows - 输入文件中的 set/p 仅适用于批处理文件中的第一行

batch-file - for循环的奇怪行为(批处理文件)

.net - 如何保证VSVARS32.BAT批处理文件永久生效?

将文件解压缩到目录中的 Windows 批处理脚本

windows-7 - DOS 批处理 : Getting partial file names

无法退出 cmd 文本输入?

windows - 获取批处理脚本中特定路径的父目录