For a few simple folders, a batch file is enough. For anything that grows past that, use PowerShell. Both work on Windows 10 and 11, so the choice comes down to the task and your comfort level when you pick a batch file or PowerShell to create folders.
A batch file is a plain text file of command prompt commands, entered line by line and run one after the other. [1] That makes it easy to start with, and for very simple jobs such as copying files or folders it can still be easier than PowerShell. [1]
PowerShell is the successor to batch, and batch is no longer the first choice once a task gets complex. [1] Below you’ll see how each one creates folders, where each falls short, and how to match one to your job.
Batch file vs PowerShell at a glance
Batch files suit short, simple folder jobs, while PowerShell is the better fit once a task needs logic. The table sets them side by side.
Criterion | Batch file | PowerShell |
|---|---|---|
Command |
|
|
File type |
|
|
Best for | Very simple processes, such as copying files or folders [1] | Tasks that need loops, functions or conditions, and doing everything in one tool [3] |
Limits | From a certain complexity, batch files are no longer the first choice [1] | Not needed for a quick one-off set of folders |
In a batch file, you type Command Prompt commands into a plain text file, one per line, and they run in order [1]. Any simple editor is enough to write one, and .cmd has been the usual extension since Windows 2000, though .bat still works [1]. Batch does support labels and variables, but that is where it starts to get clumsy [1].
PowerShell is the successor to batch [1]. A single line such as New-Item -ItemType Directory -Path .\Desktop\TestFolder creates a folder, and you can do the whole job in PowerShell without a batch wrapper [3].
In short: for a handful of fixed folder names, batch is the lighter choice. If you need if-queries, loops or functions, PowerShell is the better tool [1].
How does a batch file create folders?
A batch file creates folders by running ordinary Command Prompt commands, one per line, from top to bottom. It is a plain text file, and a simple editor is enough to write it. [1]
What a batch file looks like
Save the text file with the extension .bat or .cmd and Windows can run it directly. [1] Each line is a command, and the commands run one after another when the file starts. [1]
For folders, the command is mkdir. The sample in E4 uses it in its script lines, with @echo off at the top of the batch file and pause at the end:
@echo off
mkdir c:\test\Myarg1
mkdir c:\test\Myarg2
pause
The sample creates two folders named Myarg1 and Myarg2 under c:\test. [4] The @echo off line keeps the commands from being echoed on screen, and pause holds the window open until you press a key. Each mkdir line makes one folder with the path you give it.
Where batch works well
You need nothing beyond Command Prompt commands you may already know. Double-click the file and it runs, and the sample’s output is two new folders after you double-click or execute the batch file. [4]
For very simple jobs, such as copying files or folders, batch files may still be easier than PowerShell. [1] A fixed set of folders, like a project template with a few names, fits that description.
Where it gets awkward
Batch files support jump labels and variables for more complex processes, but from a certain complexity they are no longer the first choice. [1] Loops, if-queries and functions are where the format starts to strain. [1]
Numbered folders show the problem. A common question asks how to create folders with the incremental names “Problem 1”, “Problem 2”, and so on. [5] With plain mkdir lines you would write every name by hand. Generating the numbers needs a loop and a counter variable, and that is where batch syntax becomes harder to read than the task deserves. It also helps to read Create Folders Automatically by Date in Windows.
How does PowerShell create folders?
PowerShell creates a folder with the New-Item cmdlet, and you set the type to Directory so it makes a folder instead of a file. A forum example shows the exact form:
New-Item -ItemType Directory -Path .\Desktop\TestFolder
-ItemType Directory tells PowerShell to make a folder, and -Path gives the location and name. The leading .\ means “start from the current folder,” so this line expects you to be in a folder that contains Desktop, such as your user profile folder.
The same forum thread also shows Get-Item -Path .\Desktop\TestFolder, which returns the folder so you can see that it exists. [3]
One tool, no batch wrapper
You do not need a batch file around this. When someone asked how to create a folder from a batch file and pass the folder name as a parameter, one reply was that you can do both in PowerShell itself. [3] Related reading: How to Create Folders From a Text File in Windows.
That means one script can accept the name and create the folder. You skip the extra launcher file and keep everything in a single place.
Better for parameters and lists of names
PowerShell fits jobs where the folder names change. Because it is a full scripting language, you can pass a name in as a parameter or work through a list of names instead of typing each one into the script.
Command Prompt can also make several folders in one line, for example mkdir Folder1 Folder2 Folder3, with names separated by spaces. [2] That works for a short fixed set. Once the names come from a list or a parameter, PowerShell is the easier fit.
Safety
These scripts only create folders, so they will not delete or overwrite your files. Still, save your open work first, and run the script in a scratch directory before pointing it at a real location, because a wrong path can put folders in the wrong place. A test folder such as “TestFolders” lets you experiment without touching your main files. [2]
Can you start PowerShell from a batch file?
Yes, a batch file can start PowerShell and hand it folder names. The batch file acts as a launcher, and the PowerShell script does the actual work. A tutorial example shows this pattern with two folder names. [4]
How the pattern works
The batch file calls PowerShell with the script path and then lists the arguments after it. Here is the batch file from that example: [4]
@echo off
Powershell.exe -File C:\test\Pass-Arguments-from-batchfile-to-powershell.ps1 Myarg1 Myarg2
pause
@echo off hides the commands as they run. Powershell.exe -File runs the named .ps1 script, and Myarg1 Myarg2 are the two folder names passed to it. pause keeps the window open so you can read the result.
The PowerShell script receives those names and runs MKDIR for each one. [4]
$MyFirstArg=$args
$MySecondArg=$args
MKDIR c:\test\$MyFirstArg
MKDIR c:\test\$MySecondArg
After you double-click the batch file, two folders named Myarg1 and Myarg2 should appear. [4]
Is the batch wrapper worth it?
It is useful when you want a double-click launch, for example a shortcut a coworker can run without opening PowerShell. The batch file hides the command line from them.
But you don’t need it. A forum answer to someone asking how to pass a folder name from a batch file to PowerShell says you can do both in PowerShell itself. [3] The same forum thread shows a one-line PowerShell approach: [3]
New-Item -ItemType Directory -Path .\Desktop\TestFolder
If you are the only person running the script, skip the wrapper and keep everything in one .ps1 file.
Windows 10 and 11
The steps are the same on Windows 10 and Windows 11. Keep in mind that Windows 10 is out of support, so Windows 11 is the better place to build routines you plan to keep.
Which one fits your task and skill level?
Pick batch for a handful of fixed folders, and PowerShell once names come from a list, need numbering, or change with each run.
A few fixed folders: batch
If you are a beginner creating the same few folders, a batch file is enough. For very simple processes, such as copying files or folders, batch files may still be easier than PowerShell. [1] A single mkdir line can create several folders at once, with names separated by spaces. [2]
mkdir Folder1 Folder2 Folder3
Put quotation marks around any name that contains a space, such as "Project A". [2]
Names from a list, numbering, or parameters: PowerShell
Choose PowerShell when the job needs loops, conditions, or functions. Batch files are no longer the first choice from a certain complexity, and PowerShell is their successor. [1]
A typical example is asking for folders named “Problem 1”, “Problem 2”, and so on, which people ask about in batch form. [5] Counting and building names is where PowerShell’s loops and parameters earn their keep. Likewise, reading names from a list or accepting them as arguments suits PowerShell better than a long run of mkdir lines.
Sharing a double-click shortcut: batch launcher
If coworkers or family just want something to double-click, a small batch file works well as the launcher. A text file saved with the .bat or .cmd extension can be run directly. [1] The batch file can then hand the real work to a PowerShell script, so you get easy launching and stronger logic together.
Quick decision guide
Your situation | Best fit |
|---|---|
Three to ten fixed folders, no logic | Batch |
Folder names read from a list | PowerShell |
Numbered or parameter-driven names | PowerShell |
Others need a double-click shortcut | Batch launcher |
Separate articles in this series cover building folders from a list, dated folders, and scheduling in detail.
The verdict
Start with a batch file when the job is simple, and move to PowerShell once it grows. For something like copying files or creating a few fixed folders, batch can still be easier than PowerShell. [1]
Once you need loops, if-queries or functions, batch stops being the first choice, and PowerShell, its successor, is the better fit. [1] It can also do the whole job on its own, with no batch wrapper. [3]
Next step: pick one approach, write the script once, save it somewhere you can find it, and reuse it instead of retyping commands each time.
