Code: Select all
Param(
[Parameter(Mandatory=$true)]
[string[]]
$find
)
Set-Location C:\script
Write-Output "Searching..."
$folders = @(a list of folders)
$excluded = @(a list of folders)
$results = foreach ($folder in $folders) {
Get-ChildItem $folder -Recurse -Exclude $excluded | Select-String -Pattern $find | select FileName, LineNumber, Path
}
$results | Out-GridView -Wait
I'm initiating that script from the (Windows) command line like so:
Code: Select all
powershell.exe -file C:\script\find.ps1 -find "something to fine"
What am I doin' wrong?