1

I want to create 25 different folders with specific names into one particular folder. I know how to create a folder with subfolders but not with multiple folder names in an iterating batch or command prompt loop.

Example: root\sound\weapons\ak,m4,m1,m45,m9, etc.

How can I array or loop iterate such a task with batch logic?

2
  • Please see my answer and let me know if it helped you resolve your issue? If so, feel free to check the little gray check mark to close it. Commented Jul 9, 2016 at 17:49
  • Do you mean you want 25 folders under root\sound\weapons\ ? Do the different folders have a sequence name or is there a list of names?
    – Zimba
    Commented Jan 29, 2020 at 8:05

1 Answer 1

1

How to create folders in one folder with batch

Hello i want to create 25 folders with names into one folder. example: root\sound\weapons\ak,m4,m1,m45,m9 etc.

I know how to create a folder with sub folders but not with multiple folders.

How i can array with batch.

Command Prompt Copy and Paste

FOR %A IN (ak,m4,m1,m45,m9) DO MD "root\sound\weapons\%~A"

Batch Script

FOR %%A IN (ak,m4,m1,m45,m9) DO MD "root\sound\weapons\%%~A"

Notes: In the logic part above where you see IN (ak,m4,m1,m45,m9) you will put the folder names in there separated by commas which you want to create. The root\sound\weapons\ could also be C:\Path\Path\ or something like that as well.

Further Reading and Resources

2
  • In %~A the ~ is not needed, you can just use %A (The ~ is only required if there are quotes in the variable %A that need to be removed). See parameters](ss64.com/nt/syntax-args.html)
    – DavidPostill
    Commented Jan 12, 2016 at 23:21
  • @DavidPostill I typically always try to keep the tilde in there in case there is other logic where double-quotes are around some other variable where that ~ parses the double quotes out so that's really just out of habit but it still works with or without it regardless but I agree in this particular instance it is not needed but it will still work with it -- strictly a habit thing I use as a standard typically as not having it has got me more than having it. Commented Jan 12, 2016 at 23:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .