<Bat>批处理删除指定文件,for循环只宜有一条语句
来源:互联网 发布:linux查核指令 编辑:程序博客网 时间:2024/05/19 22:24
想清理VS2010工程目录下的中间文件Debug/Release文件夹。
@echo offset curpath=%~dp0echo 正在清理垃圾文件,请稍候...... for /f "delims=" %%i in ('dir /b .') do call :delete_dir %%ifor /r . %%a in (.) do @if exist "%%a\ipch" rd /s /q "%%a\ipch" for /r . %%a in (.) do @if exist "%%a\*.sdf" del /s /f "%%a\*.sdf"for /r . %%a in (.) do @if exist "%%a\*.ilk" del /s /f "%%a\*.ilk"for /r . %%a in (.) do @if exist "%%a\*.pdb" del /s /f "%%a\*.pdb"echo 清理完毕!!! pause:delete_dirset "prjDir=%1"set "dbgDir=%curpath%%prjDir%\%prjDir%\Debug"set "rlsDir=%curpath%%prjDir%\%prjDir%\Release"REM echo __%prjDir%__REM echo __%dbgDir%__REM echo __%rlsDir%__if exist "%dbgDir%" rd /s /q "%dbgDir%" if exist "%rlsDir%" rd /s /q "%rlsDir%" goto :EOF
其中for循环,如果换成以下方式:
for /f "delims=" %%i in ('dir /b .') do (set "prjDir=%%i"set "dbgDir=%curpath%%prjDir%\%prjDir%\Debug"set "rlsDir=%curpath%%prjDir%\%prjDir%\Release"REM echo __%prjDir%__REM echo __%dbgDir%__REM echo __%rlsDir%__if exist "%dbgDir%" rd /s /q "%dbgDir%" if exist "%rlsDir%" rd /s /q "%rlsDir%" )
阅读全文
0 0
- <Bat>批处理删除指定文件,for循环只宜有一条语句
- bat批处理删除文件
- bat批处理笔记——删除指定类型文件示例
- bat批处理删除指定N天前的文件
- bat for语句(循环结构)
- bat批处理笔记——删除指定类型文件指定前缀名
- 批处理(bat)脚本语言(4) - FOR循环
- 批处理中的for循环语句
- windows 批处理 for循环语句
- WINDOWS BAT 遍历批处理指定后缀文件
- 批处理bat脚本删除指定天数日期之前的文件(六种方案)
- BAT批处理定期删除清理指定N天前的文件
- linux 一条语句删除指定进程
- 用批处理(.bat)文件执行SQL语句
- 批处理bat万能删除文件/夹
- bat(续七)-for语句(循环结构)
- bat删除指定时间之前文件
- bat批处理自删除
- tcp为什么要三次握手,而不能二次握手?
- 检测到有潜在危险的 Request.Form 值
- 卡在gradle build界面
- Ubuntu安装git
- Harris Corner Detector 原理及编程实现
- <Bat>批处理删除指定文件,for循环只宜有一条语句
- 【转载】SIP扩展与相关RFC介绍
- ES5中新增的Array方法详细说明
- Spring中Bean的生命周期
- 跨域+Filter+oAuth
- MySQL查询总积分前十的用户信息和总分
- 1101. Quick Sort (25)
- 【web前端】html+js实现流程进度展示条
- 爬虫记录(1)——简单爬取一个页面的内容并写入到文本中