2015-11-10 141 views

回答

0

嘗試下面的代碼,會做的正是你需要什麼:

@echo off 
cls 
setlocal EnableDelayedExpansion 
set /a count=0 
if exist neww.txt (del /s /q neww.txt) 

for /f "tokens=*" %%a in (onee.txt) do (
set /a count+=1 

if !count! EQU 4 (
echo do nothing 
)else if !count! EQU 5 (
echo do nothing 
)else (
echo %%a>>neww.txt 
) 
) 

move /y neww.txt onee.txt 
1
@echo off 
setlocal EnableDelayedExpansion 

call :CopyLines <input.txt> output.txt 
move /Y output.txt input.txt 
goto :EOF 


:CopyLines 

rem Copy lines 1, 2 and 3 
for /L %%i in (1,1,3) do (
    set "line=" 
    set /P "line=" 
    echo(!line! 
) 

rem Omit lines 4 and 5 
for /L %%i in (4,1,5) do set /P "line=" 

rem Copy the rest 
findstr "^" 

exit /B 
相關問題