简体   繁体   中英

How to search a string in multiple files and return all file information (like `dir`) in powershell?

Similar to This question . However, what I want is output similar to what you get when you ls or dir the directory, so that I get the timestamps, size, etc.

I tried

Get-ChildItem -recurse | Select-String -pattern "dummy" | group path | select lastwritetime,name

but had no success. When typing above I get:

Name                                    lastwritetime
File1.txt                                              
File2.txt                                

and so on.

您可以尝试类似:

Get-ChildItem -r | Select-String "dummy" -list | ls

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM