简体   繁体   中英

Windows Equivalent to Linux: Find -name

I am trying to figure out a command in the CLI which I know in Linux Ubuntu but I need to apply it in Microsoft.

Moreover, I am trying to find all files within a folder with a specific name. Particularly, I try to find all files which contain the term 'test' in their name. Here is the command which I know in Linux:

find \home\user\data -name '*test*'

Does anyone know the equivalent in the windows command line?

您将寻找Get-ChildItem

Get-ChildItem C:\Test -Filter "*test*"

In PowerShell you can use Get-ChildItem to find files and folders.

If you want to use regular expressions, you can combine Get-ChildItem with the Select-String or Where-Object cmdlets.

Get-ChildItem -Path C:\ -Recurse | Select-String -pattern "Regex"
Get-ChildItem -Path C:\ -Recurse | Where-Object -FilterScript {$_.name -match "regex"}

You're looking for the "dir" command. To accomplish the same thing as your original search, you would use

dir \home\user\data "*test*"

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