我说两种方法吧:
第一种:如果所有ksc文件的格式都是一样的,即“歌类”都在第6行:- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%a in ('dir /a-d /b /s *.ksc') do (
- set /a n=0
- ( for /f "delims=" %%b in (%%a) do (
- set /a n+=1
- if !n! neq 6 (
- echo %%b
- ) else (
- echo karaoke.tag('歌类', '固定字符');
- )
- ))>%%a
- )
复制代码 第二种:如果“歌类”不是都在第6行- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%a in ('dir /a-d /b /s *.ksc') do (
- ( for /f "delims=" %%b in (%%a) do (
- set "str=%%b"
- if "!str:歌类=!" neq "!str!" (
- echo karaoke.tag('歌类', '固定字符');
- ) else (
- echo %%b
- )
- ))>%%a
- )
-
复制代码
|