如何用批处理获取文本中两段指定字符串中间的内容

2025-04-07 19:12:14
推荐回答(1个)
回答1:

不清楚你的实际文件,仅以问题中的样文为据

@echo off
set @=q&set/an=0x53b7e0b4
title Any question +%@%%@% %n%
cd /d "%~dp0"
rem 保存为xx.bat跟文本放一起运行
set "file=test.txt"
powershell "if(((gc '%file%') -join \"`r`n\") -match '\"counts\":(.+?),\"match\"'){$matches[1]}"
echo;Any question +%@%%@% %n%
pause