您的位置:首页 > 其它

清除指定目录下所有文件和目录的bat脚本

2010-07-23 11:05 579 查看
这段时间不太忙,抽空学习了一下批处理的东西。编了个清除制定目录内容的小程序,备忘

代码

@echo off
setlocal

rem set enviroment variable
set dir="e:\bat files\script\test"
rem clear all files under the directory
rem del %dir%\*.* /s/q

rem clear all the subdirectories
dir %dir% /b > dir.txt
for /f "tokens=* usebackq" %%i in (dir.txt) do (
rd "e:\bat files\script\test\%%i"
)
echo all files and directories have been clear!
endlocal
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐