Commands / Files

New-Item

Create a file or folder

beginner Files Aliases ni

New-Item
 New-Item -Path .\docs -ItemType Directory
Works on
WindowsLinuxmacOS
PowerShell
5.1 and later
Reference
Microsoft Learn: New-Item

Creates files and folders. -ItemType Directory makes a folder. -ItemType File makes a file. -Force creates missing parents for files in some versions; prefer creating the folder first.

Try this

New-Item -Path .\docs\readme.txt -ItemType File

Coming from another shell

ShellWhat you might type
bash / zshmkdir -p docs
cmd.exemkdir docs

More in From bash and From cmd.

Related commands