【发布时间】:2018-07-18 08:36:36
【问题描述】:
我在files.txt 中列出了多个文件,这些文件位于不同的文件夹中。我需要获取文件信息,例如修改日期和大小,导出到.txt 或.csv 文件。
Windows 中有命令吗?或者如何将其放入批处理文件或 powershell 脚本中?
files.txt内容:
c:\windows\system32\file1.dll
c:\windows\temp\file2.dll
c:\program files\file3.exe
and so on....
编辑
我在批处理文件中尝试过,但输出看起来很糟糕:
@echo off
dir c:\windows\system32\file1.dll >>filelist.txt
dir c:\windows\temp\file2.dll >>filelist.txt
dir c:\program files\file3.exe >>filelist.txt
【问题讨论】:
-
请查看tour、How to Ask 和minimal reproducible example。你都尝试了些什么?如果你表现出一些努力会很好。
-
另外,一个快速提示:使用 Powershell,查看
Get-Content和Get-Item。 -
我已经尝试过:这在一个批处理文件上,虽然输出看起来很糟糕。 @echo off dir c:\windows\system32\file1.dll >>filelist.txt dir c:\windows\temp\file2.dll >>filelist.txt dir c:\program files\file3.exe >>filelist.txt
-
编辑您的问题并发布您在那里尝试过的代码。另外,“看起来很糟糕”是什么意思。你想要什么?
-
在命令提示符处输入
DIR /?并阅读使用信息输出。然后在一些单独的文件和目录上使用它的各种选项测试命令,(你学到了什么)。完成此操作并且您对该命令感到满意后,请在命令提示符处输入FOR /?,然后再次开始阅读。 这不是给我代码的网站,也不是教程网站,请学习如何使用命令,编写代码,如果您有问题,请通过编辑和添加到您的问题中相应地对其进行格式化。
标签: powershell batch-file filelist