使用 PowerShell 进行递归文件搜索 [英] Recursive file search using PowerShell

查看:57
本文介绍了使用 PowerShell 进行递归文件搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在所有文件夹中搜索一个文件.

I am searching for a file in all the folders.

Copyforbuild.bat 很多地方都有,我想递归搜索一下.

Copyforbuild.bat is available in many places, and I would like to search recursively.

$File = "V:\Myfolder\**\*.CopyForbuild.bat"

如何在 PowerShell 中执行此操作?

How can I do it in PowerShell?

推荐答案

使用 带有 -Recurse 开关的 Get-ChildItem cmdlet:

Use the Get-ChildItem cmdlet with the -Recurse switch:

Get-ChildItem -Path V:\Myfolder -Filter CopyForbuild.bat -Recurse -ErrorAction SilentlyContinue -Force

这篇关于使用 PowerShell 进行递归文件搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆