How to batch create number folders using CMD?

0

1

Is there a way to batch create multiple number folders using cmd in Windows 8.1 64-Bit?

I need something that'll create multiple number folders without using the following md command:

c:\users\user\desktop> md 1, 2, 3

I need something more like that'll make, per say "make folders 1-10" and I have those 10 folders after running the command.

Saku

Posted 2014-10-05T00:24:24.763

Reputation: 1

Question was closed 2014-10-12T08:13:06.423

Answers

2

The simple answer is:

 FOR /L %N IN (1,1,5) DO md "newdir_%N"

Documentation

Here is a script which makes a lot of directories: https://gist.github.com/krowe/ef10bbc9ae9e39924b7d

krowe

Posted 2014-10-05T00:24:24.763

Reputation: 5 031

0

l switch in for is for looping through given numbers, so if don't want to create newdir_1, newdir_2 and so on, but named folders, you can put the names in a separate file - folder.txt, line-by-line like that:

  • movies
  • music
  • documents
  • pictures
  • animation
  • flash

and then use the f switch

for /f %a in (folder.txt) do mkdir %a

note that if you want to create a script, ie .bat file, instead of executing the command directly you have to put an extra % in that code before the a's (local variables inside the loop) in order to make it work

user373230

Posted 2014-10-05T00:24:24.763

Reputation: