I want to output the return of this process. Anyone can help me please. Thank you.
$name = $false
switch -regex -file .\bios.txt {
'^Product Name' { $name = $true; continue }
'^\s' { if ($name) { $_.Trim() }}
'^\S' { if ($name) { return } Out-File .\PN.txt}
}
I tried that way, but the output file is empty.