在 Windows 命令提示符中仅列出路径、文件名和大小
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16725517/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
List only path, file name and size in Windows command prompt
提问by Jorge
In Windows command prompt, I'm trying to list only path, file name and size, of all files including in a folder and its sub folders. Like:
在 Windows 命令提示符下,我试图仅列出文件夹及其子文件夹中所有文件的路径、文件名和大小。喜欢:
dir /s /b /a-d "C:\MainFolder\"
Problem is that I don't know how to show size of file. Is it possible?
问题是我不知道如何显示文件的大小。是否可以?
回答by dbenham
From the command line:
从命令行:
for %F in ("c:\MainFolder\*") do @echo %~zF %F
Double up the percents if you use the command in a batch file.
如果在批处理文件中使用该命令,则将百分比加倍。
Type HELP FOR
or FOR /?
from the command prompt for more information on the various values that are available with FOR variable expansion.
在命令提示符下键入HELP FOR
或FOR /?
以获取有关 FOR 变量扩展可用的各种值的更多信息。
回答by Bal mukund kumar
Try this command ---
试试这个命令---
for %%a in (*) do echo %%a