【发布时间】:2019-11-27 09:42:25
【问题描述】:
非常简单的代码,我正在尝试使用读取主机搜索一些具有特定扩展名的文件。然后我尝试将其传递给 get-childitem 行,以便搜索上述扩展名,但它只是不起作用。
$SelectedFiles = Read-Host "Which type of file(s) do you wish to delete?"
$TargetedLocation = Read-Host "Which location are the files located?"
Get-ChildItem -Path $TargetedLocation -Include $SelectedFiles -Recurse
【问题讨论】:
-
该代码让我得到一个文件列表就好了。您使用什么作为输入,错误是什么?
标签: powershell powershell-2.0 powershell-3.0 powershell-4.0