您可以使用以下的Windows批处理命令来批量删除指定目录下指定名称的文件以及快捷方式:
@echo off
set "rootDir=C:\your\root\directory" //将 "C:\your\root\directory" 替换成您的目标根目录
set "fileName=newbie_guide.lnk" //将 "newbie_guide.lnk" 替换成您要删除的文件名
for /r "%rootDir%" %%f in (%fileName%) do (
del "%%f"
)
set "shortcutName=新手必读.lnk" //将 "新手必读.lnk" 替换成您要删除的快捷方式名
for /r "%rootDir%" %%s in (*%shortcutName%) do (
del "%%s"
)
说明:
@echo off:在命令行中不显示批处理命令。set "rootDir=C:\your\root\directory":将目标根目录的路径存储在变量rootDir中。set "fileName=newbie_guide.lnk":将要删除的文件的名称存储在变量fileName中。for /r "%rootDir%" %%f in (%fileName%) do (del "%%f"):使用for循环遍历指定目录下的所有子目录,查找匹配文件名的文件,并使用del命令删除它们。set "shortcutName=新手必读.lnk":将要删除的快捷方式的名称存储在变量shortcutName中。for /r "%rootDir%" %%s in (*%shortcutName%) do (del "%%s"):使用for循环遍历指定目录下的所有子目录,查找匹配快捷方式名的文件,并使用del命令删除它们。
注意:在Windows批处理脚本中,变量名需要使用两个百分号(%%)来表示。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END








![表情[aini]-红穆笔记](https://www.4s5.cn/wp-content/themes/zibll/img/smilies/aini.gif)
![表情[ciya]-红穆笔记](https://www.4s5.cn/wp-content/themes/zibll/img/smilies/ciya.gif)
![表情[xia]-红穆笔记](https://www.4s5.cn/wp-content/themes/zibll/img/smilies/xia.gif)


暂无评论内容