Reputation: 1
hi i am working on a batch file that will number files sequentially or by typing in the new file name. if the files are to be named sequentially it asks the user for the start number and the end number. i cant figure out how to get the new files to be made starting with the user inputted start number and only add files up to the end number. my code so far looks like this:
@echo off
setlocal
:getConfirmation
set /p consecutive="Are folders numbered consecutively?(y/n): " [y/n] ?:
if %consecutive%==y goto :consecutivefiles
if %consecutive%==n goto :nonconsecutivefiles
:consecutivefiles
set /p start="Starting file number: "
set /p end="Ending file number: "
md
EXIT
:nonconsecutivefiles
set /p name="Type folder name(s): "
md %name%,
Upvotes: 0
Views: 26
Reputation: 14325
You can set a for /L
loop to iterate through numbers.
@echo off
set /p start_num="Starting file number:"
set /p end_num="Ending file number:"
for /L %%A in (%start_num%,1,%end_num%) do md folder_%%A
exit /b
Upvotes: 1