user1664591
user1664591

Reputation: 1

Batch code to create incremental subfolders

I am kind of new to Batch scripting, I am trying to write a script to create a folder which contains incremental subfolders increased by 15.

My code so far:

echo off
echo Testing to create a file to a directory and incremental sub folders

cd C:\Batch test
set folder=%date:~10,4%%date:~7,2%%date:~4,2%
mkdir %folder%
cd C:\Batch test\%folder%
set fol=%9810%
md "%fol%"
pause 

The above code creates a folder with today's date and creates a sub folder called 810 , I want to create more sub folders with an increment of 15 eg. 825, 840, 855, ...

Any help would be very well appreciated.

Regards

Dilip

Upvotes: 0

Views: 594

Answers (1)

Nikson Kanti Paul
Nikson Kanti Paul

Reputation: 3440

you can do it using a loop, like following

 FOR /L %%I in (810, 15, 900) do (
    md %%I
 )

Detail FOR /?

Upvotes: 2

Related Questions