中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-11 22:58
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » 请问如何统计某个目录下的文件数量? 翻译为:How to count the number of files in a certain directory?
Printable Version  1,679 / 7
Floor1 toy Posted 2007-07-01 11:43
初级用户 Posts 13 Credits 32
For example, if I want to count how many *.exe files are in a directory, what command should I use and how to count it?
Floor2 wudixin96 Posted 2007-07-01 12:02
银牌会员 Posts 931 Credits 1,928
Are there any subdirectories under the directory?
Floor3 wudixin96 Posted 2007-07-01 12:16
银牌会员 Posts 931 Credits 1,928
```@echo off
for /f %%i in ('dir /s c:\windows\*.exe^|findstr "个文件"') do set a=%%i
echo There are %a% files in total
pause
```
Floor4 toy Posted 2007-07-01 16:19
初级用户 Posts 13 Credits 32
Great, there are really many experts here! Thank you
Floor5 toy Posted 2007-07-01 19:10
初级用户 Posts 13 Credits 32
What does adding a ^ after dir *.* mean?
Floor6 lxmxn Posted 2007-07-01 19:58
版主 Posts 4,938 Credits 11,386
Originally posted by toy at 2007-7-1 19:10:
What does adding a ^ after dir *.* mean?

Temporarily cancel the special function of the pipe symbol | after ^.
Floor7 shanliang8008 Posted 2007-07-02 00:33
银牌会员 Posts 514 Credits 1,148 From 河北
Batch processing is mostly consistent with C language. Unfortunately, I only know a little bit, so I can't help you.
Floor8 hhzjxss Posted 2010-08-20 22:58
新手上路 Posts 9 Credits 12
The test didn't succeed!?
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023