Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Trying to list and output files in a folder. Why does this not work?

$
0
0

$Dir = Get-ChildItem C:\inetpub -recurse `
$List = $Dir | where {$_.extension -eq ".rpt"} `
$List | Format-Table FullName -hideTableHeaders | Out-File C:\inetpub\ReportsOnDriveC.txt

Here's my error message:

Get-ChildItem : A positional parameter cannot be found that accepts argument '='.

At C:\Users\Administrator\Documents\list reports on drive c.ps1:1 char:21

+ $Dir = Get-ChildItem <<<< C:\inetpub -recurse `

+ CategoryInfo : InvalidArgument: (:) [Get-ChildItem], ParameterBindingException

+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles