中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-09 02:20
47,811 主题排行 / 349,895 发帖 / 今日 0 篇 / 48,253 会员排行
DOS批处理 & 脚本技术(批处理室) » 请教一个批量删除的问题
可打印版本  812 / 5
第1楼 dddyjq1 发表于 2008-07-01 23:49
初级用户 发帖 108 积分 175
请教一个批量删除的问题
将同一目录下的所有大小为0的.TXT 文件删除,如何写? 先谢了
第2楼 pusofalse 发表于 2008-07-02 00:11
银牌会员 发帖 646 积分 1,604
for %%a in (*.txt) do if %%~za equ 0 del %%~sa
第3楼 dddyjq1 发表于 2008-07-02 01:03
初级用户 发帖 108 积分 175
对,谢了
第4楼 danjiang 发表于 2008-07-02 14:31
初级用户 发帖 45 积分 79
不错,
能给解释一下 %%~za是什么意思吗?
第5楼 HAT 发表于 2008-07-02 18:34
版主 发帖 5,017 积分 9,023
for /?

In addition, substitution of FOR variable references has been enhanced.
You can now use the following optional syntax:

%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~dI - expands %I to a drive letter only
%~pI - expands %I to a path only
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
%~sI - expanded path contains short names only
%~aI - expands %I to file attributes of file
%~tI - expands %I to date/time of file
%~zI - expands %I to size of file
%~$PATH:I - searches the directories listed in the PATH
environment variable and expands %I to the
fully qualified name of the first one found.
If the environment variable name is not
defined or the file is not found by the
search, then this modifier expands to the
empty string
第6楼 tvzml 发表于 2008-07-09 01:10
初级用户 发帖 67 积分 157
for /f %%i in ('dir /b *.txt') do if %%~zi==0 del %%~nxi
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023