1
46
如果您在批处理脚本中,可以使用参数变量技巧获取文件大小: 文件:
这会产生与您在问题中建议的结果相同的结果。 类型
在所有疯狂的变量操作选项的命令提示下。也看到 this article 更多信息。 编辑: 仅在Windows 2000及更高版本中有效 |
2
39
如果不想在批处理脚本中执行此操作,可以从以下命令行执行此操作:
很难看,但很管用。您还可以传入一个文件掩码以获取多个文件的列表:
将显示每个.doc文件的大小和文件名。 |
3
11
使用函数可以消除~z运算符中的某些限制,尤其适用于for循环:
|
4
10
尝试 forfiles :
这个
变量
如果文件
哪些版画
作为副作用,它会清除屏幕,就像运行
|
5
3
因为您使用的是XP,所以Windows PowerShell是一个选项。
或者作为一个函数
|
6
2
|
7
1
拿 from here : 以下命令在D:驱动器上查找大小大于100 MB的文件夹:
/S选项导致搜索子目录,/M选项以兆字节为单位显示磁盘使用情况,/Q:100选项导致标记大于100 MB的文件夹,/D选项仅显示超过/Q指定阈值的文件夹。 使用diskuse命令查找特定大小的文件。以下命令显示D:驱动器上大小超过100 MB的文件:
/X:104857600选项导致显示超过104857600字节的文件,并且仅当包含/V选项(verbose)时才有效。/S选项表示搜索指定路径(在本例中为d:drive)的子目录。 使用VBScript
|
8
1
在PowerShell中,可以执行以下操作:
|
9
1
这并不是您所要求的,它只能在命令行中使用(在批处理文件中可能是无用的),但检查文件大小的一个快速方法是只使用
结果:
|
10
1
创建filesize.cmd(并放入c:\windows\system32):
|
11
1
在批处理文件中,以下内容适用于本地文件,但对网络硬盘上的文件无效
但是,它是劣质代码,因为它不适用于保存在网络驱动器上的文件(例如\nas\t e s t.jpg、\192.168.2.40\t e s t.jpg)。下面的代码适用于任何位置的文件,我自己写的。我确信有更有效的方法可以使用vbs、powershell或其他什么工具来实现这一点,但我不想这样做,这对我来说是一个好的批处理!
|
12
0
在PowerShell中,您 应该 这样做: (get childitem c:\temp\file1.txt).length |
Community wiki · 需要改变的用户界面模式? 1 年前 |
LITzman · 使用状态处理颜色主题更改 1 年前 |
Community wiki · 进程。退出(0):输出消失? 1 年前 |
arsaces · 将文本添加到特定文件的末尾 2 年前 |
YGranja · 库<图形。h> MinGW-W64缺少 2 年前 |
Felipe Palermo · Ctrl键仍被按下,按键事件() 2 年前 |
HCJ · win cmd中的批处理脚本循环 2 年前 |