Create a Directory in PowerShell with New-Item (and mkdir)

Creating a directory in PowerShell takes one command: New-Item -Path C:\Reports -ItemType Directory. Change the item type to File and the same cmdlet creates a file. Here are both in one script:

$folder = New-Item -Path C:\psfaqs\NewItem\Invoices -ItemType Directory
$file   = New-Item -Path C:\psfaqs\NewItem\Invoices\notes.txt -ItemType File

"Created folder: $($folder.FullName) ($($folder.GetType().Name))"
"Created file:   $($file.FullName) ($($file.Length) bytes)"

Output:

Created folder: C:\psfaqs\NewItem\Invoices (DirectoryInfo)
Created file:   C:\psfaqs\NewItem\Invoices\notes.txt (0 bytes)

New-Item hands back the new item, a DirectoryInfo for a folder and a 0-byte FileInfo for a file, so you can use it right away.

PowerShell 7 New-Item creating a directory and a file
New-Item -ItemType Directory created the Invoices folder (PowerShell 7)

I tested every command in PowerShell 7.6 and Windows PowerShell 5.1. Where the two versions disagree, you’ll see both outputs.

Create a directory with New-Item

You can put the whole path in -Path, or split it into a parent -Path and a -Name. Leave out the parent, or use a relative path, and New-Item creates the folder in your current location:

New-Item -Path C:\psfaqs\NewItem -Name Austin -ItemType Directory | Out-Null

Set-Location -Path C:\psfaqs\NewItem
New-Item -Path .\Denver -ItemType Directory | Out-Null
New-Item -Name Seattle -ItemType Directory | Out-Null

(Get-ChildItem -Path . -Directory).Name -join ', '

Output:

Austin, Denver, Seattle

Austin came from -Path plus -Name, Denver from a relative path, and Seattle from -Name alone. If you’re not sure where you are, check the current directory first.

-ItemType also has a short alias, -Type. To preview a command without creating anything, add -WhatIf:

New-Item -Path C:\psfaqs\NewItem\Archive -ItemType Directory -WhatIf
"Archive exists: $(Test-Path -Path C:\psfaqs\NewItem\Archive)"

Output:

What if: Performing the operation "Create Directory" on target "Destination: C:\psfaqs\NewItem\Archive".
Archive exists: False

Create a folder with mkdir and md

PowerShell on Windows still understands the old mkdir and md commands. mkdir is a built-in function that calls New-Item with -ItemType Directory for you, and md is an alias that points to mkdir:

"mkdir is a $((Get-Command -Name mkdir).CommandType)"
"md is an $((Get-Command -Name md).CommandType) for $((Get-Command -Name md).Definition)"

$new = mkdir C:\psfaqs\NewItem\Payroll
"mkdir returned a $($new.GetType().Name): $($new.FullName)"

md C:\psfaqs\NewItem\Payroll\2026\Q4 | Out-Null
"md built Payroll\2026\Q4: $(Test-Path -Path C:\psfaqs\NewItem\Payroll\2026\Q4)"

Output:

mkdir is a Function
md is an Alias for mkdir
mkdir returned a DirectoryInfo: C:\psfaqs\NewItem\Payroll
md built Payroll\2026\Q4: True
Windows PowerShell 5.1 mkdir function and md alias creating folders
mkdir is a function and md is an alias for it (Windows PowerShell 5.1)

Both return the same DirectoryInfo object as New-Item and build missing parent folders. They’re great at the prompt. In scripts, spell out New-Item so anyone reading it knows exactly what runs, the same way you’d name your own PowerShell functions clearly.

Create nested folders and subdirectories in one command