gurus....
any idea why this the code below didn't work as intended?
I see the parameters highlighted can accept string array. but when used in script below, it doesn't work, would someone please provide explaination/solution to the problem?
for example, GCI's -Path parameter accept String[], so I can type: "GCI C:\location1, C:\location 2", and I will get output file list of both location1 and location2.
thanks for your help!
Jason
cls
[string]$Option=(Read-Host "Enter Option")
if ($Option -eq 1){
Write-host "you're in 1"
}
elseif ($Option -eq 2){
Write-host "you're in 2"
[String[]]$Path = (Read-Host "Enter Path: ")
[String[]]$Include = (Read-Host "Enter Include: ")
[String[]]$Pattern = (Read-Host "Enter Pattern: ")
GCI $Path-include $Include -recurse | Select-String -pattern $Pattern | group path | select name
}
Write-Host "Press any key to continue ..."
$host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")