$searchPath = $PSScriptRoot # specify the path to search
$pattern = "*.cs" # specify the file pattern to search for
$regex = 'HTMLHelpId\s*=\s*"(.+?)"' # specify the regular expression pattern
$ids = Get-ChildItem -Path $searchPath -Filter $pattern -Recurse |
Select-String -Pattern $regex -AllMatches |
ForEach-Object { $_.Matches } |
ForEach-Object { $_.Groups[1].Value } |
Sort-Object |
Get-Unique
foreach ($id in $ids) {
$url = "https://www.test.com/application.php?ap=help&hm=&hn=$id&lg="
(Invoke-webrequest -URI $url).Content > "$PSScriptRoot\docs\$id.html"
Write-Host $url
}
759900cookie-checkPowershell Search Regex in files