私はオンラインで何日も探し回りましたが、探しているものが見つかりませんでした.
ファイルを 1 行ずつ読み込んで、ファイル名である最初のトークンを取得してから、そのファイルを実行しています。ファイルを実行した後、アーカイブ フォルダーに移動し、ファイルからテキスト行を削除してから、次の行を読み取ります。
ファイルの実行後にそのテキスト行を削除する必要がありますが、その方法がわかりません
@ECHO OFF
REM Get time date in special format
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c%%a%%b)
For /f "tokens=1-2 delims=/: " %%a in ("%TIME%") do (set mytime=%%a%%b)
REM Loop through each line
FOR /F "tokens=1-3 delims=, " %%i IN (./ready/input.txt) DO (
REM>output.txt
REM Run the file
call .\ready\%%i || goto :error
REM Move the file to archive folder
move .\ready\%%i .\archive\%mydate%_%mytime%_%%j_%%k_%%i
REM ***Remove the current line of text from input.txt ****
)
goto :EOF
:error
echo Failed with error #%errorlevel%.
exit /b %errorlevel%
編集:詳細。私がやろうとしているのは、実行されなかったファイルを追跡することです...したがって、6行のファイルがある可能性があり、1行目を読み取り、ファイルを実行し、2行目を読み取ってファイルを実行し、ファイル3を見つけることができないため、終了...最後の4行を出力できるようにする必要があります