Brendon Pifer
Brendon Pifer

Reputation: 41

Creating a folder and multiple sub-folders with a batch file

I'm currently looking to create a folder with multiple sub-folders with a batch file. The folders will be located on an external drive when its created.

I've done:

mkdir test\{subTest,subTest2,subTest3}

Which creates a test folder but it also creates separate folders for subTest,subTest2, and subTest3} which are not sub-folders to test

I've also tried:

md a:\test\subTest

Which works as it should, but I will need more folders added into the test folder.

a:\ is the drive letter for where they should be created

Would someone be able to provide a solution for this?

Upvotes: 2

Views: 5230

Answers (1)

Brendon Pifer
Brendon Pifer

Reputation: 41

@aschipfl had answered the question in the comments above.

for %%D in ("subTest" "subTest2" "subTest3") do mkdir "a:\test\%%~D"

Upvotes: 2

Related Questions