この方法でテキストファイルから行を移動する方法があるかどうかを説明してください。すべての行を文字列変数の一部として取得したいのです。この「変数行」でやりたいことをしたいので、この行を取得してtf.txtから削除する必要があります。2行目は技術的に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
)