How to create multiple folders in powershell

mkdir can create multiple directories in one go, so no need for foreach. you just have to spearate them by commas:

Here I created 3 folders (Hello, Hello2, Hello3) in a directory

PS C:\install> mkdir Hello,Hello2,Hello3


    Verzeichnis: C:\install


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       09.07.2018     10:39                Hello
d-----       09.07.2018     10:39                Hello2
d-----       09.07.2018     10:39                Hello3

Here I created 3 folders on separate subfolders in a directory:

PS C:\install> mkdir .\xy3\Hello, .\yz3\Hello2, .\tr3\Hello3


    Verzeichnis: C:\install\xy3


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       09.07.2018     10:42                Hello


    Verzeichnis: C:\install\yz3


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       09.07.2018     10:42                Hello2


    Verzeichnis: C:\install\tr3


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       09.07.2018     10:42                Hello3

There are a lot of ways doing this in powershell

1..3 | ForEach {MD ".\data\rs$_"}

or

'RS1','RS2','RS3' | % {New-Item -Name ".\data\$_" -ItemType 'Directory'}

or

for ($i=1;$i -le 3;$i++){MD ".\data\rs$i"}

or

MD .\data
Pushd .\data
$Folder = @('RS1','RS2','RS3')
Md $Folder

Where md is an alias for New-Item and
%,ForEach are aliases for ForEach-Object


You could use foreach in PowerShell to get this done

ForEach ($Dir in ("Dir1", "Dir2", "Dir3", "Dir4"))
    {
        New-Item -ItemType Directory -Path [PATH]\$Dir
    } 

Read more about ForEach in PowerShell