if ($operation -eq 'wc') {
  $showLines = $false; $showWords = $false; $showChars = $false; $showBytes = $false; $paths = [Collections.Generic.List[string]]::new()
  foreach ($arg in $toolArgs) {
    if ($arg -eq '-l' -or $arg -eq '--lines') { $showLines = $true; continue }
    if ($arg -eq '-w' -or $arg -eq '--words') { $showWords = $true; continue }
    if ($arg -eq '-m' -or $arg -eq '--chars') { $showChars = $true; continue }
    if ($arg -eq '-c' -or $arg -eq '--bytes') { $showBytes = $true; continue }
    if ($arg.StartsWith('-') -and $arg -ne '-') { Fail ('unsupported wc option on Windows route: ' + $arg) 2 }
    $paths.Add($arg)
  }
  if ($paths.Count -eq 0) { Fail 'wc requires at least one file path on Windows routes' 2 }
  if (-not ($showLines -or $showWords -or $showChars -or $showBytes)) { $showLines = $true; $showWords = $true; $showChars = $true; $showBytes = $true }
  foreach ($raw in $paths) {
    $path = Resolve-UnideskPath $raw; $text = Read-StrictText $path 1048576; $values = [Collections.Generic.List[string]]::new()
    $lineCount = [regex]::Matches($text, "`n").Count; if ($text.Length -gt 0 -and -not $text.EndsWith("`n")) { $lineCount += 1 }
    if ($showLines) { $values.Add([string]$lineCount) }
    if ($showWords) { $values.Add([string]([regex]::Matches($text, '\S+').Count)) }
    if ($showChars) { $values.Add([string]$text.Length) }
    if ($showBytes) { $values.Add([string]([IO.FileInfo]$path).Length) }
    $values.Add($path); [Console]::Out.WriteLine([string]::Join(' ', $values))
  }
  exit 0
}
