Answer the question
In order to leave comments, you need to log in
How to implement a .bat to copy a non-empty file with a counter up to a certain value?
Hello, there is a 1023.txt file that needs to be copied with the information saved up to 1029.txt. How can this be done? The code for the basics used from the topic Creating a simple .bat to create .txt files?
if exist 1023.txt (
set /a counter = 1
goto LOOP
)
xcopy 1023.txt
goto END
:LOOP
if exist 102%counter%.xlsx (
set /a counter += 1
goto LOOP
)
xcopy 102%counter%.xlsx
:END
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question