A
A
aliswrk2020-09-23 09:45:13
cmd/bat
aliswrk, 2020-09-23 09:45:13

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


I'm sorry for such a stupid question

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question