- <#*,:&cls
- @echo off
- cd /d "%~dp0"
- powershell -C "Set-Location -LiteralPath ([Environment]::CurrentDirectory);. ([ScriptBlock]::Create((Get-Content -LiteralPath \"%~f0\" -ReadCount 0 | Out-String)))"
- pause
- exit /b
- #>
- #
- $a = "a.txt"
- $b = "b.txt"
- $encoding = New-Object System.Text.UTF8Encoding -ArgumentList $false
- $re = [regex]'data-fakeid="([^"]*)"'
- $txt = [System.IO.File]::ReadAllText($a, $encoding)
- [system.io.file]::WriteAllLines($b, $(foreach ($m in $re.Matches($txt)) {
- $m.Groups[1].Value
- }), $encoding)
复制代码
|