请解释一下是否可以以这种方式从文本文件中移动某些行,我想将每一行都作为字符串变量。我想用这个“变量行”做我想要的,所以我需要把这一行从 tf.txt 中删除,之后第二行将是 tf.txt 的第一行,我可以将它用作第一行再次。
@echo off
echo abc>tf.txt
echo d>>tf.txt
echo e>>tf.txt
rem only sets(and echoes) 1-st row; i want take 1st,2nd,3rd...
rem for example, first echo number of variable
rem then below, in new line, echo char(acters)
setlocal enabledelayedexpansion
for /l %%a in (1,1,5) do (
set /a count=%%a
echo !count!
set /p count=<tf.txt
echo !count!
rem on this point i need to delete 1-st row of tf.txt
rem so i think it will echo the second row if first row
rem doesnt exist at all
pause
)
我做了一些有用的东西。请给出意见。你喜欢吗?
@echo off
rem line taker from txt files
md linetaker
cd linetaker
echo 000000000000000000000000000000000>group.txt
echo 111111111111111111111111111111111>>group.txt
echo 222222222222222222222222222222222>>group.txt
for /f %%x in (group.txt) do (
for /f %%l in ("%%x") do ( echo %%l>>tmp.txt)
move /y tmp.txt "%%x".txt
)