Collect candidate href values and verify simple root-relative local destinations.

Sheet: 22 of 25 | Platform: Windows 10/11 | Shell: PowerShell 7.x and Windows PowerShell 5.1 (unless marked otherwise) | Editorial review: November 24, 2026

PowerShell cheat sheet index

Examples use the MGU project root and illustrative staging, backup, and download paths. Replace them with existing, approved paths as needed. Unless explicitly marked as a continuation, examples are independent. Read commands before running them; commands that write or modify files can change existing data.

Quick commands

1. Locate lines containing href attributes

Get-ChildItem -LiteralPath 'C:\MGU\library' -Recurse -File -Filter '*.html' |
    Select-String -Pattern '\bhref\s*=' | Select-Object Path, LineNumber, Line

2. Extract quoted href candidates from one known UTF-8 page

$text = Get-Content -LiteralPath 'C:\MGU\index.html' -Raw -Encoding UTF8
[regex]::Matches($text, '(?i)\bhref\s*=\s*["'']([^"'']+)["'']') |
    ForEach-Object { $_.Groups[1].Value }

3. Check a directory-style local URL against its index

Test-Path -LiteralPath 'C:\MGU\library\index.html' -PathType Leaf

4. Check an extensionless local page URL

Test-Path -LiteralPath 'C:\MGU\library\example.html' -PathType Leaf

5. Check a fixed list of simple root-relative URLs

$root = 'C:\MGU'
$urls = '/library/', '/library/example', '/component/lib.css'
foreach ($url in $urls) {
    $rel = $url.TrimStart('/').Replace('/','\')
    if ($url.EndsWith('/')) { $rel += 'index.html' }
    elseif (-not [IO.Path]::HasExtension($rel)) { $rel += '.html' }
    $target = Join-Path $root $rel
    [pscustomobject]@{Url=$url; Target=$target; Exists=(Test-Path -LiteralPath $target -PathType Leaf)}
}

6. Check an explicitly chosen public URL over HTTP

try {
    (Invoke-WebRequest -Uri 'https://maloneuniversity.org/library/' -UseBasicParsing -TimeoutSec 20 -ErrorAction Stop).StatusCode
} catch { Write-Warning $_.Exception.Message }

Operational notes

Regex extraction is only a candidate scan; comments, scripts, multiline markup, relative URLs, entities, fragments, query strings and routing need a real HTML parser and URL resolver. The mapping example accepts only fixed simple root-relative paths. A local file match does not prove the published URL works, and HTTP failures may be transient.

Official documentation