You can add the same subfolder to many folders at once, but not from File Explorer. Windows has no built-in single step for it there, so you create the subfolder in each parent by hand or use a command. Command Prompt and PowerShell both ship with Windows 10 and 11 and need no third-party tools. [1][2] To go further, see How to Create Folders From a Text File in Windows.
The usual approach is to go to the parent location and let a command do the repeating. Command Prompt’s mkdir can create several folders in one line, and PowerShell can pipe a list of names into New-Item -ItemType Directory. [1][2] It also helps to read Batch Script to Create Folders.
Say you keep a folder for each client and want an Invoices subfolder in every one. Instead of opening each client folder and creating it again, one short command does the whole batch without touching what is already inside. Use mkdir for a short list of names, and a loop when the list is long.
What should you know before you start?
The steps in this article work the same way in Windows 11 and Windows 10, and both use Command Prompt or PowerShell. Windows 10 is past its end of support, so Windows 11 is the better place to run them long term. [2]
Start in the parent location
Open Command Prompt first. Press Windows+R, type cmd, and press Enter. [1] You can also click Start, search for command prompt, and press Enter. [2]
Then use cd to move to the folder that holds your parent folders. For example, to work inside Documents, type:
cd C:\Users\<YourUsername>\Documents
Replace <YourUsername> with your own account name. [1] Every command you run afterward acts in that current directory. [2]
If you would rather not type the path, hold Shift, right-click the folder in File Explorer, and choose “Copy as Path.” Then type cd, press Spacebar, paste with Ctrl+V, and press Enter. [2]
What mkdir can do
mkdir (short for “make directory”) creates folders. [1] It can make one folder, several at once, nested folders, or a mix of these. [2]
To make several at once, separate the names with spaces:
mkdir Folder1 Folder2 Folder3
Windows creates all three inside the current directory. [1]
Your existing files stay put
Adding a subfolder only creates something new inside each parent. The parent folders and their current contents are not changed by the mkdir commands shown here.
If an error appears, run Command Prompt as administrator by right-clicking it and choosing “Run as Administrator,” then select “Yes” at the User Account Control prompt. [2]
How do you add a subfolder to several folders with Command Prompt?
Command Prompt can add the same subfolder to several parent folders with a single mkdir command. Mistyped paths create stray folders, so back up important data and try the command on a test copy first. [1]
Open Command Prompt. Press Windows+R, type
cmd, and press Enter. [1]Go to the folder that holds your parent folders with
cd. For example:cd "C:\Users\<YourUsername>\Documents"Replace
<YourUsername>with your own account name. [1]List each path you want to create in one
mkdircommand, separated by spaces. If a name contains a space, put the whole path in quotation marks:mkdir "Project A\Invoices" "Project B\Invoices"Each quoted path is a parent folder, a backslash, then the new subfolder. [1][2]
Press Enter. The new
Invoicesfolder should now appear inside both Project A and Project B, and the other contents of those folders stay as they were.
The same pattern works for names without spaces, such as mkdir ClientA\Invoices ClientB\Invoices. Quotes are only needed when a name has a space. [1]
If you get an error, you may be working in a protected location. In that case, run Command Prompt as an administrator by right-clicking it and choosing Run as administrator, then select Yes at the User Account Control prompt. [2]
How do you do it with PowerShell for many folders?
PowerShell can add the same subfolder to many parents in one pipeline: you pipe the parent folder names into ForEach-Object and run New-Item -ItemType Directory for each one. The source shows this pattern with a list of names and with a numbered loop, so it scales from a handful of folders to hundreds.
Press Windows + R, type powershell, and press Enter. [1]
Move to the location that holds your parent folders, for example your Documents folder:
cd "C:\Users\<YourUsername>\Documents"
Pipe your list into
ForEach-Object. The source’s pattern creates folders by name, using$_for the current item in the list:
"Design","Development","Testing","Deployment" | ForEach-Object {New-Item -ItemType Directory -Name $_}
To place a subfolder inside each parent, give
New-Itema path instead of a bare name. Build it from the parent name plus the subfolder name, for example-Name "$_\Invoices"in place of-Name $_. The-ItemType Directorypart tellsNew-Itemto make a folder rather than a file. The parent folders must already exist, as in theProject AandProject Bexample, and their contents are untouched.
For larger jobs, a number range does the counting for you. This command creates Folder1 through Folder100:
1..100 | ForEach-Object {New-Item -ItemType Directory -Name "Folder$_"}
The 1..100 part produces the numbers 1 to 100, and each one becomes $_ in the folder name. [1] Changing the 100 changes how many folders you get, so one line covers a job that would take hundreds of manual clicks.
What if the parent folders are listed in a text file?
If your parent folder names already sit in a text file, you can read the list and create a subfolder in each one. Both Command Prompt and PowerShell can do this. Save the names in folders.txt, one name per line, and put quotes around any name that contains spaces.
A short example file might look like this:
Project A
Project B
Project C
Command Prompt
First use cd to move to the location that holds the list. Then run this loop:
for /f "delims=" %a in (folders.txt) do mkdir "%a"
for /f reads folders.txt line by line, "delims=" keeps each whole line together so spaces do not split a name, and mkdir "%a" creates a folder for each line. [1]
To add a subfolder inside each listed parent, put the subfolder after the variable, for example mkdir "%a\Invoices".
PowerShell
This command reads the file and creates a folder for every line:
Get-Content "C:\Users\<YourUsername>\Desktop\folders.txt" | ForEach-Object {New-Item -ItemType Directory -Name $_}
Get-Content reads each line, ForEach-Object runs the braces once per line, and New-Item -ItemType Directory -Name $_ creates a folder named after that line. Replace <YourUsername> with your own account name. [1]
The folder is created in your current location, so move there first with cd. A name with spaces needs no extra quotes in the file because PowerShell treats each line as one value. To place a subfolder inside each parent, build the path in the name, such as -Name "$_\Invoices".
Can you save the commands to reuse them?
Yes. A short batch file (a plain text file saved with a .bat extension) lets you rerun the same folder-creating commands whenever you need them, without retyping anything.
The source shows this pattern, which goes in the file with one command per line:
@echo off
cd C:\Users\<YourUsername>\Documents
mkdir Folder1 Folder2 Folder3
pause
Here is what each line does:
@echo offstops the window from printing every command as it runs.cdmoves to the location where the folders should be created. Replace<YourUsername>with your own account name.mkdircreates the folders listed after it, separated by spaces.pausekeeps the window open so you can read the result before closing it.
To adapt it for subfolders, swap the mkdir line for your own paths. For example, mkdir "Project A\Invoices" "Project B\Invoices" adds an Invoices folder inside each project, and the quotes handle the spaces in the names.
Reusing it when new parent folders appear
When you add a new client or project, open the .bat file in Notepad, add the new path to the mkdir line (or add another mkdir line), and save it. Then double-click the file to run it again.
To keep the line readable as the list grows, put each parent on its own mkdir line. Save the file in a place you will remember, such as next to your parent folders, so the cd line and the file stay easy to match up.
What mistakes should you avoid?
Most problems come down to three slips: running the command in the wrong place, skipping quotes, and mistyping the subfolder name. Each one creates folders you did not intend.
Running the command in the wrong location
Commands like mkdir act on the current working directory, so every command you run performs its action in that folder. [2] If you are still in your user folder instead of the parent location, the new folders land there, not inside your client folders.
One easy way to land in the right place is to hold Shift, right-click the folder in File Explorer, and choose “Copy as Path”. Then type cd, press Spacebar, paste with Ctrl+V, and press Enter. [2]
Forgetting quotes around names with spaces
Without quotes, mkdir treats each space as a separator between folder names. [1] So mkdir Project A creates two folders, “Project” and “A”, rather than one called “Project A”.
Wrap every name that contains a space in quotation marks, like this:
mkdir "Project A" "Project B" "Project C"
The same applies to a path such as cd "C:\Users\<YourUsername>\Documents", where quotes keep the whole path together. [1]
Typos in the subfolder name
If you type the subfolder name by hand in each command, a slip like “Invoces” in one line quietly creates a differently named folder in that parent. You then end up with a mix, and later scripts or searches will miss the odd one out.
To avoid this, type the name once and reuse it. A loop such as ForEach-Object {New-Item -ItemType Directory -Name $_} takes each name from a list rather than from fresh typing. [1] Copying the name from a single line also helps when you use mkdir directly.
Which method should you pick?
Pick the method that matches how many parent folders you have. For a handful, a single mkdir line in Command Prompt is quick. For dozens or hundreds, a PowerShell loop saves typing, and a text file works well when the list already exists.[1]
Before you run the full list, try the command on one parent folder and open it to see the new subfolder. If it looks right, run the rest. Your next step: pick one client or project folder and add the subfolder there first.
