How to create multiple sub-directories in one command from windows command prompt?



As an IT administrator, you may find yourself in need of creating multiple subdirectories in one command from the Windows command prompt. This can be a time-consuming process if you’re manually creating each directory one-by-one. Fortunately, there are ways to speed up this process.

The first way is to use the “mkdir” command. This command is short for “make directory” and can be used to create multiple subdirectories in one command. To do this, open the command prompt and type in the desired command. For example, if you wanted to create three subdirectories called “sub1”, “sub2”, and “sub3”, you would type in the following command:

mkDIR sub1 sub2 sub3

This will create all three subdirectories in one command.

The second way to create multiple subdirectories in one command is to use the “FOR” loop. This loop can be used to iterate through a list of items and create multiple subdirectories in one command. To do this, open the command prompt and type in the following command:

FOR %%d IN (list_of_dirs) DO MKDIR %%d

Replace “list_of_dirs” with the desired list of subdirectories. For example, if you wanted to create three subdirectories called “sub1”, “sub2”, and “sub3”, you would type in the following command:

FOR %%d IN (sub1 sub2 sub3) DO MKDIR %%d

This will create all three subdirectories in one command.

The third way to create multiple subdirectories in one command is to use the “XCOPY” command. This command can be used to copy an entire directory structure from one location to another. To do this, open the command prompt and type in the following command:

XCOPY source_dir dest_dir /s /e

Replace “source_dir” with the directory you want to copy from, and “dest_dir” with the directory you want to copy to. This command will copy all the subdirectories from the source directory to the destination directory.

Creating multiple subdirectories in one command can be a time-saving process. By using the “mkdir”, “FOR” loop, or “XCOPY” commands, you can quickly and easily create multiple subdirectories in one command. This can be especially helpful if you’re working with large directory structures or need to create multiple subdirectories on a regular basis.

Inquire Now

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Find your next full or part-time role here

ScaleDesk can either help you find your next full time gig or a part time side gig where you can create extra income!

Onboard with us once
Skip HR screening and go to the final interview with with only your resume and a video interview you never have to redo
Get paid electronically every month for the hours you work
We will be your reference even if you work for us once

IT Teams: Use ScaleDesk to augment your team

Schedule Demo