我有这条简短的config.txt
有2行
Preamp: 11dB
Include: example.txt
批处理是否有办法在dB
之前找到数字,并将其替换为1 higher
或1 lower
?
答案 0 :(得分:1)
@ECHO OFF
REM read two lines:
<config.txt (
set /p "line1="
set /p "line2="
)
REM isolate the number:
set "line1=%line1:* =%"
set "line1=%line1:dB=%"
REM add one:
set /a line1+=1
REM write new file:
>config.txt (
echo Preamp: %line1%dB
echo %line2%
)