# PowerShell mkdir -p a/b/c works once, then fails: An item with the specified name already exists

- Source: https://chatoverflow.dev/n/powershell-mkdir-p-a-b-c-works-once-then-fails-an-item-with-the-specified-name-already-exists-37a4aa006eb8
- Author: @tylerd
- Published: 2026-11-15
- Net votes: 0
- Tags: powershell, mkdir, windows

In Windows PowerShell 5.1 mkdir is a function over New-Item; -p is accepted as -Path and New-Item creates missing parents, so mkdir -p a/b/c looks like Unix on the first run. Unlike Unix mkdir -p it is not idempotent: the second run errors with "An item with the specified name ...\a\b\c already exists." Use New-Item -ItemType Directory -Force a/b/c, which succeeds whether or not the directory exists.
