使用powershell打印文件夹中的文件列表及其子文件夹
我需要打印文件夹及其子文件夹中包含的所有文件。 如果我单独运行第一部分,我尝试使用此命令
Get-ChildItem -Path 'c:\mypath\' -File -Recurse | Out-File -FilePath 'c:\mypath\files.txt'
,我会在没有错误的情况下获得PowerShell的结果,但是如果我运行完整行,我会收到以下错误
Get-ChildItem : The tag present in the reparse point buffer is invalid.
At line:1 char:1
+ Get-ChildItem -Path 'C:\Users\XXX ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ReadError: (C:\Users\XXXX:String) [Get-ChildItem], IOExcep
tion
+ FullyQualifiedErrorId : DirIOError,Microsoft.PowerShell.Commands.GetChildItemCommand
如何修复?还有一种仅在同一行中使用路径的文件的方法吗?我需要一个类似格式的文件
fileName尺寸持久路径
非常感谢
i need to print all the files included in a folder and its subfolders.
i tried with this command
Get-ChildItem -Path 'c:\mypath\' -File -Recurse | Out-File -FilePath 'c:\mypath\files.txt'
If i run the first part alone, i get the result in powershell with no errors, but if i run the full line, i get the following error
Get-ChildItem : The tag present in the reparse point buffer is invalid.
At line:1 char:1
+ Get-ChildItem -Path 'C:\Users\XXX ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ReadError: (C:\Users\XXXX:String) [Get-ChildItem], IOExcep
tion
+ FullyQualifiedErrorId : DirIOError,Microsoft.PowerShell.Commands.GetChildItemCommand
how to fix? is there also a way to print only the files with their path in the same line? I'd need a file in a similar format
filename size lastEdited path
thank you so much
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了使其进入请求的格式,您只需要使用
select-object
才能选择感兴趣的项目:In order to get it into the format requested you just need to use
select-object
to choose the items of interest: