문제

I have a text file with no. of file formats. I want to print those file names to one text file one by one. Problem here is as soon as it check second file format name and try to write in text file, it will erase the first record info.Here is what I have return

@ECHO OFF
setlocal enableDelayedExpansion
SET "formats=.css.js.jsp."
FOR /F "delims=#" %%A in (demo.txt) do (
   IF "!formats:%%~xA.=!" neq "!formats!" (
     %%~nxA > output.txt
   ) ELSE (
     ECHO Incorrect file format
   )
) 
도움이 되었습니까?

해결책

Just use >> redirection.

%%~nxA >> output.txt

It will append redirected output to the end of your file, instead of cleaning the file before redirecting output there.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top