PowerShell: Create a New Folder
Need to create a new folder - as part of a setup script, organizing files, or preparing a directory structure? This one-liner creates it directly from the terminal.
Prerequisites:
- Privileges: None
- Module: Built-in, no import needed
Quick Command:
New-Item -Path "C:\NewFolder" -ItemType Directory
Example Output:
Directory: C:\
Mode LastWriteTime Name
---- ------------- ----
d----- 7/19/2026 1:45 PM NewFolder
📦
Want all of them at once?
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
How It Works:
- New-Item is a general-purpose cmdlet for creating files, folders, registry keys, and more - the -ItemType parameter tells it what to create.
- -Path "C:\NewFolder" sets the location and name of the new folder - replace this with whatever path you actually want.
- -ItemType Directory tells New-Item to create a folder specifically, rather than a file or another item type.
- The output confirms the folder was created, showing its mode (d--— indicates a directory), creation time, and name.
Pro Tip:
Running this twice on the same path normally throws an error, since the folder already exists. Adding -Force suppresses that error and lets the script continue - it won't delete or overwrite anything inside an existing folder, it just skips the "already exists" complaint so repeated runs of a script don't fail.
New-Item -Path "C:\NewFolder" -ItemType Directory -Force