Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 遍历目录树并显示属性_Batch File_Windows 8 - Fatal编程技术网

Batch file 遍历目录树并显示属性

Batch file 遍历目录树并显示属性,batch-file,windows-8,Batch File,Windows 8,我一直在尝试遍历Windows 2008上给定的目录树(使用批处理脚本),一直到叶子,并在每个步骤列出所有者、上次修改日期和文件大小。例如 C:\Folder1\Folder1a\File1.txt Adam 10/20/2017 1024 MB C:\Folder1\Folder1a\File2.dat Peter 03/02/2018 2048 MB C:\Folder1\Folder1b\File2a.dat John 06/21/2018 100 Bytes C:\Folder2\Fol

我一直在尝试遍历Windows 2008上给定的目录树(使用批处理脚本),一直到叶子,并在每个步骤列出所有者、上次修改日期和文件大小。例如

C:\Folder1\Folder1a\File1.txt Adam 10/20/2017 1024 MB
C:\Folder1\Folder1a\File2.dat Peter 03/02/2018 2048 MB
C:\Folder1\Folder1b\File2a.dat John 06/21/2018 100 Bytes
C:\Folder2\Folder2a\Folder2aa\File2aa.zip Mary 15/08/2018 600 MB
到目前为止,我搜索了一下,只能找到下面的内容(没有产生所需的输出)。我有Unix的背景,只有非常基本的批处理知识。有人能帮忙吗?也要赢

for /R %%f in (*) do dir /b /s /on /q “%%f”

您不能在此处使用裸格式
/b
,因为这是您想要实际显示的内容,其次,您不需要递归每个文件,然后仍然对每个文件执行dir,而只需执行以下操作:

for /f "delims=" %%a in ('dir /a-d /q /on ^| findstr /vi "bytes"') do echo %%a
要将输出重定向到文件,请执行以下操作:

for /f "delims=" %%a in ('dir /a-d /q /on ^| findstr /vi "bytes"') do echo %%a >> "D:\mypath\myfile.txt"

非常感谢。很好。。如何在输出$list中的属性/字段之间插入分隔符并重定向到文件?$list |排序路径|导出csv-路径c:\your.csv-delimiter','-notypeinformation一个最终帮助请:-如何获取上次访问的日期以及如何选择mof大小为1GB或更大的文件?
for /f "delims=" %%a in ('dir /a-d /q /on ^| findstr /vi "bytes"') do echo %%a >> "D:\mypath\myfile.txt"