
CODE: [Copy to clipboard]@echo off&setlocal enabledelayedexpansion
set /p insert=请输入要插"市一中113班"的行:
set n=100
for /f "delims=" %%i in ('dir/b *.txt') do (
set /a n+=1
set BeginName=%%i
for /f "delims=" %%a in ('findstr /iv "该同学的名字为" !BeginName!') do (
set /a m+=1
if %insert% neq !m! (echo %%a>>!n!.txt) else (echo 市一中113班 >>!n!.txt)
)
echo.>>!n!.txt
echo 该同学为!n!号>>!n!.txt
set m=0
)
CODE: [Copy to clipboard]@echo off&setlocal enabledelayedexpansion
for /f "delims=" %%a in ('dir/b *.avi *.rm *.dat') do set "%%~na=%%~xa"
set /a n=100
for /f "delims=" %%a in ('dir/b *.txt') do (
set /a n+=1
>"%%~na_tmp.txt" echo 市一中113班
for /f "usebackq delims=" %%b in ("%%a") do (
set "str=%%b"
if "!str:~0,5"=="该生姓名为" (
>>"%%~na_tmp.txt" echo //%%b
) else (>>"%%~na_tmp.txt" echo %%b)
)
>>"%%~na_tmp.txt" echo 该生的作品为 %%~na!%%~na!
ren "%%~na_tmp.txt" "!n!.txt"
del /q "%%a" 2>nul
)
pause
CODE: [Copy to clipboard]@echo off&setlocal enabledelayedexpansion
set n=20000
set m=0
set /p insertLine=输入要插入数据的行号:
set /p insertData=输入要插入的数据,系统会自动将数据插入到指定的行:
for /f "delims=" %%i in ('dir/s/b/a-d') do (
set Video=%%i
set Video_x=%%~xi
set Video_n=%%~ni
if /i not "!Video_x!"==".KSC" (
if /i not "!Video_x!"==".bat" (
set/a n+=1
for /f "delims=" %%a in ('type !Video_n!.KSC') do (
set ClassInner=%%a
set /a m+=1
if "!ClassInner:~,19!"=="karaoke.CommonVideo" (>>!n!.KSC echo karaoke.CommonVideo := '!n!!Video_x!';)
if %insertLine% neq !m! (>>!n!.KSC echo %%a) else (>>!n!.KSC echo %insertData% )
)
set m=0
ren "%%i" "!n!!Video_x!"
del !Video_n!.KSC /q >nul 2>nul
)
)
)
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |