本帖最后由 pd1 于 2022-12-2 14:59 编辑
文本存为test.txt文件,我win11默认utf8了就没改- <# :
- @echo off
- powershell -NoProfile -ExecutionPolicy bypass "Get-Content -literal '%~f0' |Out-String|Invoke-Expression"
- pause
- #>
- $text=gc .\test.txt -Encoding UTF8
- $reg=[regex]'{ ID = (\d+), Name = ".*?"},?'
- $reg.Matches($text)|%{"[{0}] = {1}" -f $_.Groups[1].Value,$_.Groups[0].Value}
复制代码
|